Add more tests for paragraphs and headings with extra spacing
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Extra newlines: More paragraphs with indented comment
308 !! input
309 a
310
311 <!--boo-->
312
313 b
314 !!result
315 <p>a
316 </p><p><br />
317 b
318 </p>
319 !!end
320
321 !! test
322 Extra newlines followed by heading
323 !! input
324 a
325
326
327
328 =b=
329 [[a]]
330
331
332 =b=
333 !! result
334 <p>a
335 </p><p><br />
336 </p>
337 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a>]</span></h1>
338 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
339 </p><p><br />
340 </p>
341 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a>]</span></h1>
342
343 !! end
344
345 !! test
346 Extra newlines between heading and content are swallowed
347 !! input
348 =b=
349
350
351
352 [[a]]
353 !! result
354 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a>]</span></h1>
355 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
356 </p>
357 !! end
358
359 !! test
360 Parsing an URL
361 !! input
362 http://fr.wikipedia.org/wiki/🍺
363 <!-- EasterEgg we love beer, better be able be able to link to it -->
364 !! result
365 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
366 </p>
367 !! end
368
369 !! test
370 Simple list
371 !! input
372 * Item 1
373 * Item 2
374 !! result
375 <ul><li> Item 1
376 </li><li> Item 2
377 </li></ul>
378
379 !! end
380
381 !! test
382 Italics and bold
383 !! input
384 * plain
385 * plain''italic''plain
386 * plain''italic''plain''italic''plain
387 * plain'''bold'''plain
388 * plain'''bold'''plain'''bold'''plain
389 * plain''italic''plain'''bold'''plain
390 * plain'''bold'''plain''italic''plain
391 * plain''italic'''bold-italic'''italic''plain
392 * plain'''bold''bold-italic''bold'''plain
393 * plain'''''bold-italic'''italic''plain
394 * plain'''''bold-italic''bold'''plain
395 * plain''italic'''bold-italic'''''plain
396 * plain'''bold''bold-italic'''''plain
397 * plain l'''italic''plain
398 * plain l''''bold''' plain
399 !! result
400 <ul><li> plain
401 </li><li> plain<i>italic</i>plain
402 </li><li> plain<i>italic</i>plain<i>italic</i>plain
403 </li><li> plain<b>bold</b>plain
404 </li><li> plain<b>bold</b>plain<b>bold</b>plain
405 </li><li> plain<i>italic</i>plain<b>bold</b>plain
406 </li><li> plain<b>bold</b>plain<i>italic</i>plain
407 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
408 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
409 </li><li> plain<i><b>bold-italic</b>italic</i>plain
410 </li><li> plain<b><i>bold-italic</i>bold</b>plain
411 </li><li> plain<i>italic<b>bold-italic</b></i>plain
412 </li><li> plain<b>bold<i>bold-italic</i></b>plain
413 </li><li> plain l'<i>italic</i>plain
414 </li><li> plain l'<b>bold</b> plain
415 </li></ul>
416
417 !! end
418
419 # this example taken from the simple/Moon article
420 !! test
421 Italics and possessives
422 !! input
423 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
424 !! result
425 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
426 </p>
427 !! end
428
429 ###
430 ### 2-quote opening sequence tests
431 ###
432 !! test
433 Italics and bold: 2-quote opening sequence: (2,2)
434 !! input
435 ''foo''
436 !! result
437 <p><i>foo</i>
438 </p>
439 !!end
440
441
442 !! test
443 Italics and bold: 2-quote opening sequence: (2,3)
444 !! input
445 ''foo'''
446 !! result
447 <p><i>foo'</i>
448 </p>
449 !!end
450
451
452 !! test
453 Italics and bold: 2-quote opening sequence: (2,4)
454 !! input
455 ''foo''''
456 !! result
457 <p><i>foo''</i>
458 </p>
459 !!end
460
461
462 !! test
463 Italics and bold: 2-quote opening sequence: (2,5) (php)
464 !! options
465 php
466 !! input
467 ''foo'''''
468 !! result
469 <p><i>foo</i>
470 </p>
471 !!end
472 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
473 !! test
474 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
475 !! options
476 parsoid
477 !! input
478 ''foo'''''
479 !! result
480 <p><i>foo</i><b></b>
481 </p>
482 !!end
483
484
485 ###
486 ### 3-quote opening sequence tests
487 ###
488
489 !! test
490 Italics and bold: 3-quote opening sequence: (3,2)
491 !! input
492 '''foo''
493 !! result
494 <p>'<i>foo</i>
495 </p>
496 !!end
497
498
499 !! test
500 Italics and bold: 3-quote opening sequence: (3,3)
501 !! input
502 '''foo'''
503 !! result
504 <p><b>foo</b>
505 </p>
506 !!end
507
508
509 !! test
510 Italics and bold: 3-quote opening sequence: (3,4)
511 !! input
512 '''foo''''
513 !! result
514 <p><b>foo'</b>
515 </p>
516 !!end
517
518
519 !! test
520 Italics and bold: 3-quote opening sequence: (3,5) (php)
521 !! options
522 php
523 !! input
524 '''foo'''''
525 !! result
526 <p><b>foo</b>
527 </p>
528 !!end
529 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
530 !! test
531 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
532 !! options
533 parsoid
534 !! input
535 '''foo'''''
536 !! result
537 <p><b>foo<i></i></b>
538 </p>
539 !!end
540
541
542 ###
543 ### 4-quote opening sequence tests
544 ###
545
546 !! test
547 Italics and bold: 4-quote opening sequence: (4,2)
548 !! input
549 ''''foo''
550 !! result
551 <p>''<i>foo</i>
552 </p>
553 !!end
554
555
556 !! test
557 Italics and bold: 4-quote opening sequence: (4,3)
558 !! input
559 ''''foo'''
560 !! result
561 <p>'<b>foo</b>
562 </p>
563 !!end
564
565
566 !! test
567 Italics and bold: 4-quote opening sequence: (4,4)
568 !! input
569 ''''foo''''
570 !! result
571 <p>'<b>foo'</b>
572 </p>
573 !!end
574
575
576 !! test
577 Italics and bold: 4-quote opening sequence: (4,5) (php)
578 !! options
579 php
580 !! input
581 ''''foo'''''
582 !! result
583 <p>'<b>foo</b>
584 </p>
585 !!end
586 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
587 !! test
588 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
589 !! options
590 parsoid
591 !! input
592 ''''foo'''''
593 !! result
594 <p>'<b>foo<i></i></b>
595 </p>
596 !!end
597
598
599 ###
600 ### 5-quote opening sequence tests
601 ###
602
603 !! test
604 Italics and bold: 5-quote opening sequence: (5,2) (php)
605 !! options
606 php
607 !! input
608 '''''foo''
609 !! result
610 <p><b><i>foo</i></b>
611 </p>
612 !!end
613 # Parsoid reverses the nesting order, compared to the PHP parser
614 !! test
615 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
616 !! options
617 parsoid
618 !! input
619 '''''foo''
620 !! result
621 <p><i><b>foo</b></i>
622 </p>
623 !!end
624
625
626 !! test
627 Italics and bold: 5-quote opening sequence: (5,3)
628 !! input
629 '''''foo'''
630 !! result
631 <p><i><b>foo</b></i>
632 </p>
633 !!end
634
635
636 !! test
637 Italics and bold: 5-quote opening sequence: (5,4)
638 !! input
639 '''''foo''''
640 !! result
641 <p><i><b>foo'</b></i>
642 </p>
643 !!end
644
645
646 !! test
647 Italics and bold: 5-quote opening sequence: (5,5)
648 !! input
649 '''''foo'''''
650 !! result
651 <p><i><b>foo</b></i>
652 </p>
653 !!end
654
655 ###
656 ### multiple quote sequences in a line
657 ###
658 !! test
659 Italics and bold: multiple quote sequences: (2,4,2)
660 !! input
661 ''foo''''bar''
662 !! result
663 <p><i>foo'<b>bar</b></i>
664 </p>
665 !!end
666
667
668 !! test
669 Italics and bold: multiple quote sequences: (2,4,3)
670 !! input
671 ''foo''''bar'''
672 !! result
673 <p><i>foo'<b>bar</b></i>
674 </p>
675 !!end
676
677
678 !! test
679 Italics and bold: multiple quote sequences: (2,4,4)
680 !! input
681 ''foo''''bar''''
682 !! result
683 <p><i>foo'<b>bar'</b></i>
684 </p>
685 !!end
686
687
688 !! test
689 Italics and bold: multiple quote sequences: (3,4,2) (php)
690 !! options
691 php
692 !! input
693 '''foo''''bar''
694 !! result
695 <p><b>foo'</b>bar
696 </p>
697 !!end
698 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
699 !! test
700 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
701 !! options
702 parsoid
703 !! input
704 '''foo''''bar''
705 !! result
706 <p><b>foo'</b>bar<i></i>
707 </p>
708 !!end
709
710
711 !! test
712 Italics and bold: multiple quote sequences: (3,4,3) (php)
713 !! options
714 php
715 !! input
716 '''foo''''bar'''
717 !! result
718 <p><b>foo'</b>bar
719 </p>
720 !!end
721 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
722 !! test
723 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
724 !! options
725 parsoid
726 !! input
727 '''foo''''bar'''
728 !! result
729 <p><b>foo'</b>bar<b></b>
730 </p>
731 !!end
732
733 ###
734 ### other quote tests
735 ###
736 !! test
737 Italics and bold: other quote tests: (2,3,5)
738 !! input
739 ''this is about '''foo's family'''''
740 !! result
741 <p><i>this is about <b>foo's family</b></i>
742 </p>
743 !!end
744
745
746 !! test
747 Italics and bold: other quote tests: (2,(3,3),2)
748 !! input
749 ''this is about '''foo's''' family''
750 !! result
751 <p><i>this is about <b>foo's</b> family</i>
752 </p>
753 !!end
754
755
756 !! test
757 Italics and bold: other quote tests: (3,2,3,2)
758 !! input
759 '''this is about ''foo'''s family''
760 !! result
761 <p><b>this is about <i>foo</i></b><i>s family</i>
762 </p>
763 !!end
764
765
766 # The Parsoid team believes the PHP parser's output on this test is wrong.
767 # It only checks for convert-to-bold-on-single-character-word when the word
768 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
769 # This means that the bold token in position 2 (0-indexed) gets converted by
770 # parsoid, but doesn't get changed by the PHP parser.
771 !! test
772 Italics and bold: other quote tests: (3,2,3,3) (php)
773 !! options
774 php
775 !! input
776 '''this is about ''foo'''s family'''
777 !! result
778 <p>'<i>this is about </i>foo<b>s family</b>
779 </p>
780 !!end
781 # This is the output the Parsoid team believes to be correct.
782 !! test
783 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
784 !! options
785 parsoid
786 !! input
787 '''this is about ''foo'''s family'''
788 !! result
789 <p><b>this is about <i>foo'</i>s family</b>
790 </p>
791 !!end
792
793
794 !! test
795 Italics and bold: other quote tests: (3,(2,2),3)
796 !! input
797 '''this is about ''foo's'' family'''
798 !! result
799 <p><b>this is about <i>foo's</i> family</b>
800 </p>
801 !!end
802
803
804 !! test
805 Italicized possessive
806 !! input
807 The ''[[Main Page]]'''s talk page.
808 !! result
809 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
810 </p>
811 !! end
812
813 ###
814 ### Non-html5 tags
815 ###
816
817 !! test
818 Non-html5 tags should be accepted
819 !! input
820 <center>''foo''</center>
821 <big>''foo''</big>
822 <font>''foo''</font>
823 <strike>''foo''</strike>
824 <tt>''foo''</tt>
825 !! result
826 <center><i>foo</i></center>
827 <p><big><i>foo</i></big>
828 <font><i>foo</i></font>
829 <strike><i>foo</i></strike>
830 <tt><i>foo</i></tt>
831 </p>
832 !! end
833
834 ###
835 ### <nowiki> test cases
836 ###
837
838 !! test
839 <nowiki> unordered list
840 !! input
841 <nowiki>* This is not an unordered list item.</nowiki>
842 !! result
843 <p>* This is not an unordered list item.
844 </p>
845 !! end
846
847 !! test
848 <nowiki> spacing
849 !! input
850 <nowiki>Lorem ipsum dolor
851
852 sed abit.
853 sed nullum.
854
855 :and a colon
856 </nowiki>
857 !! result
858 <p>Lorem ipsum dolor
859
860 sed abit.
861 sed nullum.
862
863 :and a colon
864
865 </p>
866 !! end
867
868 !! test
869 nowiki 3
870 !! input
871 :There is not nowiki.
872 :There is <nowiki>nowiki</nowiki>.
873
874 #There is not nowiki.
875 #There is <nowiki>nowiki</nowiki>.
876
877 *There is not nowiki.
878 *There is <nowiki>nowiki</nowiki>.
879 !! result
880 <dl><dd>There is not nowiki.
881 </dd><dd>There is nowiki.
882 </dd></dl>
883 <ol><li>There is not nowiki.
884 </li><li>There is nowiki.
885 </li></ol>
886 <ul><li>There is not nowiki.
887 </li><li>There is nowiki.
888 </li></ul>
889
890 !! end
891
892 !! test
893 Entities inside <nowiki>
894 !! input
895 <nowiki>&lt;</nowiki>
896 !! result
897 <p>&lt;
898 </p>
899 !! end
900
901
902 ###
903 ### Comments
904 ###
905 !! test
906 Comments and Indent-Pre
907 !! input
908 <!-- comment 1 --> asdf
909
910 <!-- comment 1 --> asdf
911 <!-- comment 2 -->
912
913 <!-- comment 1 --> asdf
914 <!-- comment 2 -->xyz
915
916 <!-- comment 1 --> asdf
917 <!-- comment 2 --> xyz
918 !! result
919 <pre>asdf
920 </pre>
921 <pre>asdf
922 </pre>
923 <pre>asdf
924 </pre>
925 <p>xyz
926 </p>
927 <pre>asdf
928 xyz
929 </pre>
930 !! end
931
932 !! test
933 Comment test 2a
934 !! input
935 asdf
936 <!-- comment 1 -->
937 jkl
938 !! result
939 <p>asdf
940 jkl
941 </p>
942 !! end
943
944 !! test
945 Comment test 2b
946 !! input
947 asdf
948 <!-- comment 1 -->
949
950 jkl
951 !! result
952 <p>asdf
953 </p><p>jkl
954 </p>
955 !! end
956
957 !! test
958 Comment test 3
959 !! input
960 asdf
961 <!-- comment 1 -->
962 <!-- comment 2 -->
963 jkl
964 !! result
965 <p>asdf
966 jkl
967 </p>
968 !! end
969
970 !! test
971 Comment test 4
972 !! input
973 asdf<!-- comment 1 -->jkl
974 !! result
975 <p>asdfjkl
976 </p>
977 !! end
978
979 !! test
980 Comment spacing
981 !! input
982 a
983 <!-- foo --> b <!-- bar -->
984 c
985 !! result
986 <p>a
987 </p>
988 <pre> b
989 </pre>
990 <p>c
991 </p>
992 !! end
993
994 !! test
995 Comment whitespace
996 !! input
997 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
998 !! result
999
1000 !! end
1001
1002 !! test
1003 Comment semantics and delimiters
1004 !! input
1005 <!-- --><!----><!-----><!------>
1006 !! result
1007
1008 !! end
1009
1010 !! test
1011 Comment semantics and delimiters, redux
1012 !! input
1013 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1014 -- foo -- funky huh? ... -->
1015 !! result
1016
1017 !! end
1018
1019 !! test
1020 Comment semantics and delimiters: directors cut
1021 !! input
1022 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1023 everything starting with < followed by !-- until the first -- and > we see,
1024 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1025 -->-->
1026 !! result
1027 <p>--&gt;
1028 </p>
1029 !! end
1030
1031 !! test
1032 Comment semantics: nesting
1033 !! input
1034 <!--<!-- no, we're not going to do anything fancy here -->-->
1035 !! result
1036 <p>--&gt;
1037 </p>
1038 !! end
1039
1040 !! test
1041 Comment semantics: unclosed comment at end
1042 !! input
1043 <!--This comment will run out to the end of the document
1044 !! result
1045
1046 !! end
1047
1048 !! test
1049 Comment in template title
1050 !! input
1051 {{f<!---->oo}}
1052 !! result
1053 <p>FOO
1054 </p>
1055 !! end
1056
1057 !! test
1058 Comment on its own line post-expand
1059 !! input
1060 a
1061 {{blank}}<!---->
1062 b
1063 !! result
1064 <p>a
1065 </p><p>b
1066 </p>
1067 !! end
1068
1069 !! test
1070 Comment on its own line post-expand with non-significant whitespace
1071 !! input
1072 a
1073 {{blank}} <!---->
1074 b
1075 !! result
1076 <p>a
1077 </p><p>b
1078 </p>
1079 !! end
1080
1081 ###
1082 ### paragraph wraping tests
1083 ###
1084 !! test
1085 No block tags
1086 !! input
1087 a
1088
1089 b
1090 !! result
1091 <p>a
1092 </p><p>b
1093 </p>
1094 !! end
1095 !! test
1096 Block tag on one line
1097 !! input
1098 a <div>foo</div>
1099
1100 b
1101 !! result
1102 a <div>foo</div>
1103 <p>b
1104 </p>
1105 !! end
1106
1107 !! test
1108 Block tag on both lines
1109 !! input
1110 a <div>foo</div>
1111
1112 b <div>foo</div>
1113 !! result
1114 a <div>foo</div>
1115 b <div>foo</div>
1116
1117 !! end
1118
1119 !! test
1120 Multiple lines without block tags
1121 !! input
1122 <div>foo</div> a
1123 b
1124 c
1125 d<!--foo--> e
1126 x <div>foo</div> z
1127 !! result
1128 <div>foo</div> a
1129 <p>b
1130 c
1131 d e
1132 </p>
1133 x <div>foo</div> z
1134
1135 !! end
1136
1137 !! test
1138 Empty lines between lines with block tags
1139 !! input
1140 <div></div>
1141
1142
1143 <div></div>a
1144
1145 b
1146 <div>a</div>b
1147
1148 <div>b</div>d
1149
1150
1151 <div>e</div>
1152 !! result
1153 <div></div>
1154 <p><br />
1155 </p>
1156 <div></div>a
1157 <p>b
1158 </p>
1159 <div>a</div>b
1160 <div>b</div>d
1161 <p><br />
1162 </p>
1163 <div>e</div>
1164
1165 !! end
1166
1167 ###
1168 ### Preformatted text
1169 ###
1170 !! test
1171 Preformatted text
1172 !! input
1173 This is some
1174 Preformatted text
1175 With ''italic''
1176 And '''bold'''
1177 And a [[Main Page|link]]
1178 !! result
1179 <pre>This is some
1180 Preformatted text
1181 With <i>italic</i>
1182 And <b>bold</b>
1183 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1184 </pre>
1185 !! end
1186
1187 !! test
1188 Ident preformatting with inline content
1189 !! input
1190 a
1191 ''b''
1192 !! result
1193 <pre>a
1194 <i>b</i>
1195 </pre>
1196 !! end
1197
1198 !! test
1199 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1200 !! input
1201 <pre><nowiki>
1202 <b>
1203 <cite>
1204 <em>
1205 </nowiki></pre>
1206 !! result
1207 <pre>
1208 &lt;b&gt;
1209 &lt;cite&gt;
1210 &lt;em&gt;
1211 </pre>
1212
1213 !! end
1214
1215 !! test
1216 Regression with preformatted in <center>
1217 !! input
1218 <center>
1219 Blah
1220 </center>
1221 !! result
1222 <center>
1223 <pre>Blah
1224 </pre>
1225 </center>
1226
1227 !! end
1228
1229 # Expected output in the following test is not really expected (there should be
1230 # <pre> in the output) -- it's only testing for well-formedness.
1231 !! test
1232 Bug 6200: Preformatted in <blockquote>
1233 !! input
1234 <blockquote>
1235 Blah
1236 </blockquote>
1237 !! result
1238 <blockquote>
1239 Blah
1240 </blockquote>
1241
1242 !! end
1243
1244 !! test
1245 <pre> with attributes (bug 3202)
1246 !! input
1247 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1248 !! result
1249 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1250
1251 !! end
1252
1253 !! test
1254 <pre> with width attribute (bug 3202)
1255 !! input
1256 <pre width="8">Narrow screen goodies</pre>
1257 !! result
1258 <pre width="8">Narrow screen goodies</pre>
1259
1260 !! end
1261
1262 !! test
1263 <pre> with forbidden attribute (bug 3202)
1264 !! input
1265 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1266 !! result
1267 <pre width="8">Narrow screen goodies</pre>
1268
1269 !! end
1270
1271 !! test
1272 Entities inside <pre>
1273 !! input
1274 <pre>&lt;</pre>
1275 !! result
1276 <pre>&lt;</pre>
1277
1278 !! end
1279
1280 !! test
1281 <pre> with forbidden attribute values (bug 3202)
1282 !! input
1283 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1284 !! result
1285 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1286
1287 !! end
1288
1289 !! test
1290 <nowiki> inside <pre> (bug 13238)
1291 !! input
1292 <pre>
1293 <nowiki>
1294 </pre>
1295 <pre>
1296 <nowiki></nowiki>
1297 </pre>
1298 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1299 !! result
1300 <pre>
1301 &lt;nowiki&gt;
1302 </pre>
1303 <pre>
1304
1305 </pre>
1306 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1307
1308 !! end
1309
1310 !! test
1311 <nowiki> and <pre> preference (first one wins)
1312 !! input
1313 <pre>
1314 <nowiki>
1315 </pre>
1316 </nowiki>
1317 </pre>
1318
1319 <nowiki>
1320 <pre>
1321 <nowiki>
1322 </pre>
1323 </nowiki>
1324 </pre>
1325
1326 !! result
1327 <pre>
1328 &lt;nowiki&gt;
1329 </pre>
1330 <p>&lt;/nowiki&gt;
1331 &lt;/pre&gt;
1332 </p><p>
1333 &lt;pre&gt;
1334 &lt;nowiki&gt;
1335 &lt;/pre&gt;
1336
1337 &lt;/pre&gt;
1338 </p>
1339 !! end
1340
1341 !! test
1342 </pre> inside nowiki
1343 !! input
1344 <nowiki></pre></nowiki>
1345 !! result
1346 <p>&lt;/pre&gt;
1347 </p>
1348 !! end
1349
1350 !!test
1351 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1352 !!input
1353 {{echo|}}
1354 !!result
1355
1356 !!end
1357
1358 !!test
1359 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1360 !!input
1361 {{echo|
1362 foo}}
1363 !!result
1364 <p>foo
1365 </p>
1366 !!end
1367
1368 !! test
1369 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1370 !! input
1371 {{echo|a
1372 b}}
1373 !!result
1374 <pre>a
1375 </pre>
1376 <p>b
1377 </p>
1378 !!end
1379
1380 !! test
1381 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1382 !! input
1383 {{echo|a
1384 b
1385 c
1386 d
1387 e
1388 }}
1389 !!result
1390 <pre>a
1391 </pre>
1392 <p>b
1393 c
1394 </p>
1395 <pre>d
1396 </pre>
1397 <p>e
1398 </p>
1399 !!end
1400
1401 !!test
1402 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1403 !!input
1404 {{echo| foo}}
1405
1406 {{echo| foo}}{{echo| bar}}
1407
1408 {{echo| foo}}
1409 {{echo| bar}}
1410
1411 {{echo|<!--cmt--> foo}}
1412
1413 <!--cmt-->{{echo| foo}}
1414
1415 {{echo|{{echo| }}bar}}
1416 !!result
1417 <pre>foo
1418 </pre>
1419 <pre>foo bar
1420 </pre>
1421 <pre>foo
1422 bar
1423 </pre>
1424 <pre>foo
1425 </pre>
1426 <pre>foo
1427 </pre>
1428 <pre>bar
1429 </pre>
1430 !!end
1431
1432 !! test
1433 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1434 !! input
1435 {{echo| }}a
1436
1437 {{echo|
1438 }}a
1439
1440 {{echo|
1441 b}}
1442
1443 {{echo|a
1444 }}b
1445
1446 {{echo|a
1447 }} b
1448 !!result
1449 <pre>a
1450 </pre>
1451 <p><br />
1452 </p>
1453 <pre>a
1454 </pre>
1455 <p><br />
1456 </p>
1457 <pre>b
1458 </pre>
1459 <p>a
1460 </p>
1461 <pre>b
1462 </pre>
1463 <p>a
1464 </p>
1465 <pre>b
1466 </pre>
1467 !!end
1468
1469 !! test
1470 Templates: Single-line variant of parameter whitespace stripping test
1471 !! input
1472 {{echo| a}}
1473
1474 {{echo|1= a}}
1475
1476 {{echo|{{echo| a}}}}
1477
1478 {{echo|1={{echo| a}}}}
1479 !! result
1480 <pre>a
1481 </pre>
1482 <p>a
1483 </p>
1484 <pre>a
1485 </pre>
1486 <p>a
1487 </p>
1488 !! end
1489
1490 !! test
1491 Templates: Strip whitespace from named parameters, but not positional ones
1492 !! input
1493 {{echo|
1494 foo}}
1495
1496 {{echo|
1497 * foo}}
1498
1499 {{echo| 1 =
1500 foo}}
1501
1502 {{echo| 1 =
1503 * foo}}
1504 !! result
1505 <pre>foo
1506 </pre>
1507 <p><br />
1508 </p>
1509 <ul><li> foo
1510 </li></ul>
1511 <p>foo
1512 </p>
1513 <ul><li> foo
1514 </li></ul>
1515
1516 !! end
1517
1518 ###
1519 ### Parsoid-centric tests for testing RT edge cases for pre
1520 ###
1521
1522 !!test
1523 1a. Indent-Pre and Comments
1524 !!input
1525 a
1526 <!--a-->
1527 c
1528 !!result
1529 <pre>a
1530 </pre>
1531 <p>c
1532 </p>
1533 !!end
1534
1535 !!test
1536 1b. Indent-Pre and Comments
1537 !!input
1538 a
1539 <!--a-->
1540 c
1541 !!result
1542 <pre>a
1543 </pre>
1544 <p>c
1545 </p>
1546 !!end
1547
1548 !!test
1549 1c. Indent-Pre and Comments
1550 !!input
1551 <!--a--> a
1552
1553 <!--a--> a
1554 !!result
1555 <pre> a
1556 </pre>
1557 <pre> a
1558 </pre>
1559 !!end
1560
1561 !!test
1562 2a. Indent-Pre and tables
1563 !!input
1564 {|
1565 |-
1566 !h1!!h2
1567 |foo||bar
1568 |}
1569 !!result
1570 <table>
1571
1572 <tr>
1573 <th>h1</th>
1574 <th>h2
1575 </th>
1576 <td>foo</td>
1577 <td>bar
1578 </td></tr></table>
1579
1580 !!end
1581
1582 !!test
1583 2b. Indent-Pre and tables
1584 !!input
1585 {|
1586 |-
1587 |foo
1588 |}
1589 !!result
1590 <table>
1591
1592 <tr>
1593 <td>foo
1594 </td></tr></table>
1595
1596 !!end
1597
1598 !!test
1599 2c. Indent-Pre and tables (bug 42252)
1600 !!input
1601 {|
1602 |+ foo
1603 ! | bar
1604 |}
1605 !!result
1606 <table>
1607 <caption> foo
1608 </caption>
1609 <tr>
1610 <th> bar
1611 </th></tr></table>
1612
1613 !!end
1614
1615 !!test
1616 3a. Indent-Pre and block tags (single-line html)
1617 !!input
1618 <p> foo </p>
1619 <div> foo </div>
1620 <span> foo </span>
1621 !!result
1622 <p> foo </p>
1623 <div> foo </div>
1624 <pre><span> foo </span>
1625 </pre>
1626 !!end
1627
1628 !!test
1629 3b. Indent-Pre and block tags (pre-content on separate line)
1630 !!input
1631 <p>
1632 foo
1633 </p>
1634
1635 <div>
1636 foo
1637 </div>
1638
1639 <center>
1640 foo
1641 </center>
1642
1643 <blockquote>
1644 foo
1645 </blockquote>
1646
1647 <table><tr><td>
1648 foo
1649 </td></tr></table>
1650
1651 <ul><li>
1652 foo
1653 </li></ul>
1654
1655 !!result
1656 <p>
1657 foo
1658 </p>
1659 <div>
1660 <pre>foo
1661 </pre>
1662 </div>
1663 <center>
1664 <pre>foo
1665 </pre>
1666 </center>
1667 <blockquote>
1668 foo
1669 </blockquote>
1670 <table><tr><td>
1671 <pre>foo
1672 </pre>
1673 </td></tr></table>
1674 <ul><li>
1675 foo
1676 </li></ul>
1677
1678 !!end
1679
1680 !!test
1681 4. Multiple spaces at start-of-line
1682 !!input
1683 <p> foo </p>
1684 foo
1685 {|
1686 |foo
1687 |}
1688 !!result
1689 <p> foo </p>
1690 <pre> foo
1691 </pre>
1692 <table>
1693 <tr>
1694 <td>foo
1695 </td></tr></table>
1696
1697 !!end
1698
1699 !! test
1700 5. White-space in indent-pre
1701 NOTE: the white-space char on 2nd line is significant
1702 !! input
1703 a<br/>
1704
1705 b
1706 !! result
1707 <pre>a<br />
1708
1709 b
1710 </pre>
1711 !! end
1712
1713 ###
1714 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1715 ###
1716
1717 !!test
1718 HTML-pre: 1. embedded newlines
1719 !!input
1720 <pre>foo</pre>
1721
1722 <pre>
1723 foo
1724 </pre>
1725
1726 <pre>
1727
1728 foo
1729 </pre>
1730
1731 <pre>
1732
1733
1734 foo
1735 </pre>
1736 !!result
1737 <pre>foo</pre>
1738 <pre>
1739 foo
1740 </pre>
1741 <pre>
1742
1743 foo
1744 </pre>
1745 <pre>
1746
1747
1748 foo
1749 </pre>
1750
1751 !!end
1752
1753 !!test
1754 HTML-pre: 2: indented text
1755 !!input
1756 <pre>
1757 foo
1758 </pre>
1759 !!result
1760 <pre>
1761 foo
1762 </pre>
1763
1764 !!end
1765
1766 !!test
1767 HTML-pre: 3: other wikitext
1768 !!input
1769 <pre>
1770 * foo
1771 # bar
1772 = no-h =
1773 '' no-italic ''
1774 [[ NoLink ]]
1775 </pre>
1776 !!result
1777 <pre>
1778 * foo
1779 # bar
1780 = no-h =
1781 '' no-italic ''
1782 [[ NoLink ]]
1783 </pre>
1784
1785 !!end
1786
1787 ###
1788 ### Definition lists
1789 ###
1790 !! test
1791 Simple definition
1792 !! input
1793 ; name : Definition
1794 !! result
1795 <dl><dt> name&#160;</dt><dd> Definition
1796 </dd></dl>
1797
1798 !! end
1799
1800 !! test
1801 Definition list for indentation only
1802 !! input
1803 : Indented text
1804 !! result
1805 <dl><dd> Indented text
1806 </dd></dl>
1807
1808 !! end
1809
1810 !! test
1811 Definition list with no space
1812 !! input
1813 ;name:Definition
1814 !! result
1815 <dl><dt>name</dt><dd>Definition
1816 </dd></dl>
1817
1818 !!end
1819
1820 !! test
1821 Definition list with URL link
1822 !! input
1823 ; http://example.com/ : definition
1824 !! result
1825 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1826 </dd></dl>
1827
1828 !! end
1829
1830 !! test
1831 Definition list with bracketed URL link
1832 !! input
1833 ;[http://www.example.com/ Example]:Something about it
1834 !! result
1835 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1836 </dd></dl>
1837
1838 !! end
1839
1840 !! test
1841 Definition list with wikilink containing colon
1842 !! input
1843 ; [[Help:FAQ]]: The least-read page on Wikipedia
1844 !! result
1845 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1846 </dd></dl>
1847
1848 !! end
1849
1850 # At Brion's and JeLuF's insistence... :)
1851 !! test
1852 Definition list with news link containing colon
1853 !! input
1854 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1855 !! result
1856 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1857 </dd></dl>
1858
1859 !! end
1860
1861 !! test
1862 Malformed definition list with colon
1863 !! input
1864 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1865 !! result
1866 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1867 </dt></dl>
1868
1869 !! end
1870
1871 !! test
1872 Definition lists: colon in external link text
1873 !! input
1874 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1875 !! result
1876 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1877 </dd></dl>
1878
1879 !! end
1880
1881 !! test
1882 Definition lists: colon in HTML attribute
1883 !! input
1884 ;<b style="display: inline">bold</b>
1885 !! result
1886 <dl><dt><b style="display: inline">bold</b>
1887 </dt></dl>
1888
1889 !! end
1890
1891 !! test
1892 Definition lists: self-closed tag
1893 !! input
1894 ;one<br/>two : two-line fun
1895 !! result
1896 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1897 </dd></dl>
1898
1899 !! end
1900
1901 !! test
1902 Bug 11748: Literal closing tags
1903 !! input
1904 <dl>
1905 <dt>test 1</dt>
1906 <dd>test test test test test</dd>
1907 <dt>test 2</dt>
1908 <dd>test test test test test</dd>
1909 </dl>
1910 !! result
1911 <dl>
1912 <dt>test 1</dt>
1913 <dd>test test test test test</dd>
1914 <dt>test 2</dt>
1915 <dd>test test test test test</dd>
1916 </dl>
1917
1918 !! end
1919
1920 !! test
1921 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1922 !! input
1923 <ul><li>
1924 ; term : description
1925 * unordered
1926 </li>
1927 </ul>
1928 !! result
1929 <ul><li>
1930 <dl><dt> term&#160;</dt><dd> description
1931 </dd></dl>
1932 <ul><li> unordered
1933 </li></ul>
1934 </li>
1935 </ul>
1936
1937 !! end
1938
1939 !! test
1940
1941 Definition list with empty definition and following paragraph
1942 !! input
1943 ; term:
1944 Paragraph text
1945 !! result
1946 <dl><dt> term</dt><dd>
1947 </dd></dl>
1948 <p>Paragraph text
1949 </p>
1950 !! end
1951
1952 !! test
1953 Nested definition lists using html syntax
1954 !! input
1955 <dl><dd>
1956 <dl>
1957 <dd>Foo</dd>
1958 </dl>
1959 </dd></dl>
1960 !! result
1961 <dl><dd>
1962 <dl>
1963 <dd>Foo</dd>
1964 </dl>
1965 </dd></dl>
1966
1967 !! end
1968
1969 !! test
1970 Definition Lists: No nesting: Multiple dd's
1971 !! input
1972 ;x
1973 :a
1974 :b
1975 !! result
1976 <dl><dt>x
1977 </dt><dd>a
1978 </dd><dd>b
1979 </dd></dl>
1980
1981 !! end
1982
1983 !! test
1984 Definition Lists: Indentation: Regular
1985 !! input
1986 :i1
1987 ::i2
1988 :::i3
1989 !! result
1990 <dl><dd>i1
1991 <dl><dd>i2
1992 <dl><dd>i3
1993 </dd></dl>
1994 </dd></dl>
1995 </dd></dl>
1996
1997 !! end
1998
1999 !! test
2000 Definition Lists: Indentation: Missing 1st level
2001 !! input
2002 ::i2
2003 :::i3
2004 !! result
2005 <dl><dd><dl><dd>i2
2006 <dl><dd>i3
2007 </dd></dl>
2008 </dd></dl>
2009 </dd></dl>
2010
2011 !! end
2012
2013 !! test
2014 Definition Lists: Indentation: Multi-level indent
2015 !! input
2016 :::i3
2017 !! result
2018 <dl><dd><dl><dd><dl><dd>i3
2019 </dd></dl>
2020 </dd></dl>
2021 </dd></dl>
2022
2023 !! end
2024
2025 !! test
2026 Definition Lists: Hacky use to indent tables
2027 !! input
2028 ::{|
2029 |foo
2030 |bar
2031 |}
2032 this text
2033 should be left alone
2034 !! result
2035 <dl><dd><dl><dd><table>
2036 <tr>
2037 <td>foo
2038 </td>
2039 <td>bar
2040 </td></tr></table></dd></dl></dd></dl>
2041 <p>this text
2042 should be left alone
2043 </p>
2044 !! end
2045 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2046 ## as an empty dt item. It also ignores all but the last ";" when followed
2047 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
2048 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
2049 ## ";"s.
2050 ##
2051 ## Ex: ";;t2 ::d2" is transformed into:
2052 ##
2053 ## <dl>
2054 ## <dt>t2 </dt>
2055 ## <dd>
2056 ## <dl>
2057 ## <dt></dt>
2058 ## <dd>d2</dd>
2059 ## </dl>
2060 ## </dd>
2061 ## </dl>
2062 ##
2063 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2064 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2065 ##
2066 ## <dl>
2067 ## <dt>
2068 ## <dl>
2069 ## <dt>t2 </dt>
2070 ## <dd>:d2</dd>
2071 ## </dl>
2072 ## </dt>
2073 ## </dl>
2074 ##
2075 ## All Parsoid only definition list tests have this difference.
2076 ##
2077 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2078 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2079
2080 !! test
2081 Table / list interaction: indented table with lists in table contents
2082 !! input
2083 :{|
2084 |-
2085 | a
2086 * b
2087 |-
2088 | c
2089 * d
2090 |}
2091 !! result
2092 <dl><dd><table>
2093
2094 <tr>
2095 <td> a
2096 <ul><li> b
2097 </li></ul>
2098 </td></tr>
2099 <tr>
2100 <td> c
2101 <ul><li> d
2102 </li></ul>
2103 </td></tr></table></dd></dl>
2104
2105 !! end
2106
2107 !!test
2108 Table / list interaction: lists nested in tables nested in indented lists
2109 !!input
2110 :{|
2111 |
2112 :a
2113 :b
2114 |
2115 *c
2116 *d
2117 |}
2118
2119 *e
2120 *f
2121 !!result
2122 <dl><dd><table>
2123 <tr>
2124 <td>
2125 <dl><dd>a
2126 </dd><dd>b
2127 </dd></dl>
2128 </td>
2129 <td>
2130 <ul><li>c
2131 </li><li>d
2132 </li></ul>
2133 </td></tr></table></dd></dl>
2134 <ul><li>e
2135 </li><li>f
2136 </li></ul>
2137
2138 !!end
2139
2140 !! test
2141 Definition Lists: Nesting: Multi-level (Parsoid only)
2142 !! options
2143 parsoid
2144 !! input
2145 ;t1 :d1
2146 ;;t2 ::d2
2147 ;;;t3 :::d3
2148 !! result
2149 <dl>
2150 <dt>t1 </dt>
2151 <dd>d1</dd>
2152 <dt>
2153 <dl>
2154 <dt>t2 </dt>
2155 <dd>:d2</dd>
2156 <dt>
2157 <dl>
2158 <dt>t3 </dt>
2159 <dd>::d3</dd>
2160 </dl>
2161 </dt>
2162 </dl>
2163 </dt>
2164 </dl>
2165
2166
2167 !! end
2168
2169
2170 !! test
2171 Definition Lists: Nesting: Test 2 (Parsoid only)
2172 !! options
2173 parsoid
2174 !! input
2175 ;t1
2176 ::d2
2177 !! result
2178 <dl>
2179 <dt>t1</dt>
2180 <dd>
2181 <dl>
2182 <dd>d2</dd>
2183 </dl>
2184 </dd>
2185 </dl>
2186
2187 !! end
2188
2189
2190 !! test
2191 Definition Lists: Nesting: Test 3 (Parsoid only)
2192 !! options
2193 parsoid
2194 !! input
2195 :;t1
2196 ::::d2
2197 !! result
2198 <dl>
2199 <dd>
2200 <dl>
2201 <dt>t1</dt>
2202 <dd>
2203 <dl>
2204 <dd>
2205 <dl>
2206 <dd>d2</dd>
2207 </dl>
2208 </dd>
2209 </dl>
2210 </dd>
2211 </dl>
2212 </dd>
2213 </dl>
2214
2215 !! end
2216
2217
2218 !! test
2219 Definition Lists: Nesting: Test 4
2220 !! input
2221 ::;t3
2222 :::d3
2223 !! result
2224 <dl><dd><dl><dd><dl><dt>t3
2225 </dt><dd>d3
2226 </dd></dl>
2227 </dd></dl>
2228 </dd></dl>
2229
2230 !! end
2231
2232
2233 ## The Parsoid team believes the following three test exposes a
2234 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2235 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2236 !! test
2237 Definition Lists: Mixed Lists: Test 1 (php)
2238 !! options
2239 php
2240 !! input
2241 :;* foo
2242 ::* bar
2243 :; baz
2244 !! result
2245 <dl><dd><dl><dt><ul><li> foo
2246 </li><li> bar
2247 </li></ul>
2248 </dt></dl>
2249 <dl><dt> baz
2250 </dt></dl>
2251 </dd></dl>
2252
2253 !! end
2254 !! test
2255 Definition Lists: Mixed Lists: Test 1 (parsoid)
2256 !! options
2257 parsoid
2258 !! input
2259 :;* foo
2260 ::* bar
2261 :; baz
2262 !! result
2263 <dl><dd><dl><dt><ul><li> foo
2264 </li></ul></dt><dd><ul><li> bar
2265 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2266 !! end
2267
2268 !! test
2269 Definition Lists: Mixed Lists: Test 2
2270 !! input
2271 *: d1
2272 *: d2
2273 !! result
2274 <ul><li><dl><dd> d1
2275 </dd><dd> d2
2276 </dd></dl>
2277 </li></ul>
2278
2279 !! end
2280
2281
2282 !! test
2283 Definition Lists: Mixed Lists: Test 3
2284 !! input
2285 *::: d1
2286 *::: d2
2287 !! result
2288 <ul><li><dl><dd><dl><dd><dl><dd> d1
2289 </dd><dd> d2
2290 </dd></dl>
2291 </dd></dl>
2292 </dd></dl>
2293 </li></ul>
2294
2295 !! end
2296
2297
2298 !! test
2299 Definition Lists: Mixed Lists: Test 4
2300 !! input
2301 *;d1 :d2
2302 *;d3 :d4
2303 !! result
2304 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2305 </dd><dt>d3&#160;</dt><dd>d4
2306 </dd></dl>
2307 </li></ul>
2308
2309 !! end
2310
2311
2312 !! test
2313 Definition Lists: Mixed Lists: Test 5
2314 !! input
2315 *:d1
2316 *:: d2
2317 !! result
2318 <ul><li><dl><dd>d1
2319 <dl><dd> d2
2320 </dd></dl>
2321 </dd></dl>
2322 </li></ul>
2323
2324 !! end
2325
2326
2327 !! test
2328 Definition Lists: Mixed Lists: Test 6
2329 !! input
2330 #*:d1
2331 #*::: d3
2332 !! result
2333 <ol><li><ul><li><dl><dd>d1
2334 <dl><dd><dl><dd> d3
2335 </dd></dl>
2336 </dd></dl>
2337 </dd></dl>
2338 </li></ul>
2339 </li></ol>
2340
2341 !! end
2342
2343
2344 !! test
2345 Definition Lists: Mixed Lists: Test 7
2346 !! input
2347 :* d1
2348 :* d2
2349 !! result
2350 <dl><dd><ul><li> d1
2351 </li><li> d2
2352 </li></ul>
2353 </dd></dl>
2354
2355 !! end
2356
2357
2358 !! test
2359 Definition Lists: Mixed Lists: Test 8
2360 !! input
2361 :* d1
2362 ::* d2
2363 !! result
2364 <dl><dd><ul><li> d1
2365 </li></ul>
2366 <dl><dd><ul><li> d2
2367 </li></ul>
2368 </dd></dl>
2369 </dd></dl>
2370
2371 !! end
2372
2373
2374 !! test
2375 Definition Lists: Mixed Lists: Test 9
2376 !! input
2377 *;foo :bar
2378 !! result
2379 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2380 </dd></dl>
2381 </li></ul>
2382
2383 !! end
2384
2385
2386 !! test
2387 Definition Lists: Mixed Lists: Test 10
2388 !! input
2389 *#;foo :bar
2390 !! result
2391 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2392 </dd></dl>
2393 </li></ol>
2394 </li></ul>
2395
2396 !! end
2397
2398 # The Parsoid team disagrees with the PHP parser's seemingly-random
2399 # rules regarding dd/dt on the next two tests. Parsoid is more
2400 # consistent, and recognizes the shared nesting and keeps the
2401 # still-open tags around until the nesting is complete.
2402
2403 !! test
2404 Definition Lists: Mixed Lists: Test 11 (php)
2405 !! options
2406 php
2407 !! input
2408 *#*#;*;;foo :bar
2409 *#*#;boo :baz
2410 !! result
2411 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2412 </dt></dl>
2413 </dd></dl>
2414 </li></ul>
2415 </dd></dl>
2416 <dl><dt>boo&#160;</dt><dd>baz
2417 </dd></dl>
2418 </li></ol>
2419 </li></ul>
2420 </li></ol>
2421 </li></ul>
2422
2423 !! end
2424 !! test
2425 Definition Lists: Mixed Lists: Test 11 (parsoid)
2426 !! options
2427 parsoid
2428 !! input
2429 *#*#;*;;foo :bar
2430 *#*#;boo :baz
2431 !! result
2432 <ul>
2433 <li>
2434 <ol>
2435 <li>
2436 <ul>
2437 <li>
2438 <ol>
2439 <li>
2440 <dl>
2441 <dt>
2442 <ul>
2443 <li>
2444 <dl>
2445 <dt>
2446 <dl>
2447 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2448 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2449 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2450 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2451 !! end
2452
2453
2454 !! test
2455 Definition Lists: Weird Ones: Test 1 (php)
2456 !! options
2457 php
2458 !! input
2459 *#;*::;; foo : bar (who uses this?)
2460 !! result
2461 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2462 </dt></dl>
2463 </dd></dl>
2464 </dd></dl>
2465 </dd></dl>
2466 </li></ul>
2467 </dd></dl>
2468 </li></ol>
2469 </li></ul>
2470
2471 !! end
2472 !! test
2473 Definition Lists: Weird Ones: Test 1 (parsoid)
2474 !! options
2475 parsoid
2476 !! input
2477 *#;*::;; foo : bar (who uses this?)
2478 !! result
2479 <ul>
2480 <li>
2481 <ol>
2482 <li>
2483 <dl>
2484 <dt>
2485 <ul>
2486 <li>
2487 <dl>
2488 <dd>
2489 <dl>
2490 <dd>
2491 <dl>
2492 <dt>
2493 <dl>
2494 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2495 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2496 !! end
2497
2498 ###
2499 ### External links
2500 ###
2501 !! test
2502 External links: non-bracketed
2503 !! input
2504 Non-bracketed: http://example.com
2505 !! result
2506 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2507 </p>
2508 !! end
2509
2510 !! test
2511 External links: numbered
2512 !! input
2513 Numbered: [http://example.com]
2514 Numbered: [http://example.net]
2515 Numbered: [http://example.com]
2516 !! result
2517 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2518 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2519 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2520 </p>
2521 !!end
2522
2523 !! test
2524 External links: specified text
2525 !! input
2526 Specified text: [http://example.com link]
2527 !! result
2528 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2529 </p>
2530 !!end
2531
2532 !! test
2533 External links: trail
2534 !! input
2535 Linktrails should not work for external links: [http://example.com link]s
2536 !! result
2537 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2538 </p>
2539 !! end
2540
2541 !! test
2542 External links: dollar sign in URL
2543 !! input
2544 http://example.com/1$2345
2545 !! result
2546 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2547 </p>
2548 !! end
2549
2550 !! test
2551 External links: dollar sign in URL (named)
2552 !! input
2553 [http://example.com/1$2345]
2554 !! result
2555 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2556 </p>
2557 !!end
2558
2559 !! test
2560 External links: open square bracket forbidden in URL (bug 4377)
2561 !! input
2562 http://example.com/1[2345
2563 !! result
2564 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2565 </p>
2566 !! end
2567
2568 !! test
2569 External links: open square bracket forbidden in URL (named) (bug 4377)
2570 !! input
2571 [http://example.com/1[2345]
2572 !! result
2573 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2574 </p>
2575 !!end
2576
2577 !! test
2578 External links: nowiki in URL link text (bug 6230)
2579 !!input
2580 [http://example.com/ <nowiki>''example site''</nowiki>]
2581 !! result
2582 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2583 </p>
2584 !! end
2585
2586 !! test
2587 External links: newline forbidden in text (bug 6230 regression check)
2588 !! input
2589 [http://example.com/ first
2590 second]
2591 !! result
2592 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2593 second]
2594 </p>
2595 !!end
2596
2597 !! test
2598 External links: Pipe char between url and text
2599 !! input
2600 [http://example.com | link]
2601 !! result
2602 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2603 </p>
2604 !!end
2605
2606 !! test
2607 External links: protocol-relative URL in brackets
2608 !! input
2609 [//example.com/ Test]
2610 !! result
2611 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2612 </p>
2613 !! end
2614
2615 !! test
2616 External links: protocol-relative URL in brackets without text
2617 !! input
2618 [//example.com]
2619 !! result
2620 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2621 </p>
2622 !! end
2623
2624 !! test
2625 External links: protocol-relative URL in free text is left alone
2626 !! input
2627 //example.com/Foo
2628 !! result
2629 <p>//example.com/Foo
2630 </p>
2631 !!end
2632
2633 !! test
2634 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2635 !! input
2636 foo//example.com/Foo
2637 !! result
2638 <p>foo//example.com/Foo
2639 </p>
2640 !! end
2641
2642 !! test
2643 External image
2644 !! input
2645 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2646 !! result
2647 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2648 </p>
2649 !! end
2650
2651 !! test
2652 External image from https
2653 !! input
2654 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2655 !! result
2656 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2657 </p>
2658 !! end
2659
2660 !! test
2661 Link to non-http image, no img tag
2662 !! input
2663 Link to non-http image, no img tag: ftp://example.com/test.jpg
2664 !! result
2665 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2666 </p>
2667 !! end
2668
2669 !! test
2670 External links: terminating separator
2671 !! input
2672 Terminating separator: http://example.com/thing,
2673 !! result
2674 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2675 </p>
2676 !! end
2677
2678 !! test
2679 External links: intervening separator
2680 !! input
2681 Intervening separator: http://example.com/1,2,3
2682 !! result
2683 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2684 </p>
2685 !! end
2686
2687 !! test
2688 External links: old bug with URL in query
2689 !! input
2690 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2691 !! result
2692 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2693 </p>
2694 !! end
2695
2696 !! test
2697 External links: old URL-in-URL bug, mixed protocols
2698 !! input
2699 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2700 !! result
2701 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2702 </p>
2703 !!end
2704
2705 !! test
2706 External links: URL in text
2707 !! input
2708 URL in text: [http://example.com http://example.com]
2709 !! result
2710 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2711 </p>
2712 !! end
2713
2714 !! test
2715 External links: Clickable images
2716 !! input
2717 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2718 !! result
2719 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2720 </p>
2721 !!end
2722
2723 !! test
2724 External links: raw ampersand
2725 !! input
2726 Old &amp; use: http://x&y
2727 !! result
2728 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2729 </p>
2730 !! end
2731
2732 !! test
2733 External links: encoded ampersand
2734 !! input
2735 Old &amp; use: http://x&amp;y
2736 !! result
2737 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2738 </p>
2739 !! end
2740
2741 !! test
2742 External links: encoded equals (bug 6102)
2743 !! input
2744 http://example.com/?foo&#61;bar
2745 !! result
2746 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2747 </p>
2748 !! end
2749
2750 !! test
2751 External links: [raw ampersand]
2752 !! input
2753 Old &amp; use: [http://x&y]
2754 !! result
2755 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2756 </p>
2757 !! end
2758
2759 !! test
2760 External links: [encoded ampersand]
2761 !! input
2762 Old &amp; use: [http://x&amp;y]
2763 !! result
2764 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2765 </p>
2766 !! end
2767
2768 !! test
2769 External links: [encoded equals] (bug 6102)
2770 !! input
2771 [http://example.com/?foo&#61;bar]
2772 !! result
2773 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2774 </p>
2775 !! end
2776
2777 !! test
2778 External links: [IDN ignored character reference in hostname; strip it right off]
2779 !! input
2780 [http://e&zwnj;xample.com/]
2781 !! result
2782 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2783 </p>
2784 !! end
2785
2786 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2787 # Where an external link could easily circumvent the sanitization of the text of
2788 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2789 # test demands a higher standard. That's a bit strange.
2790 #
2791 # Example:
2792 #
2793 # http://e‌xample.com -> [http://example.com|http://example.com]
2794 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2795 #
2796 # The first example is sanitized, but the second is not. Any security benefits
2797 # from this production are trivial to circumvent. Either remove this test and
2798 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2799 # the test accordingly.
2800 #
2801 # All our love,
2802 # The Parsoid team.
2803 !! test
2804 External links: IDN ignored character reference in hostname; strip it right off
2805 !! input
2806 http://e&zwnj;xample.com/
2807 !! result
2808 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2809 </p>
2810 !! end
2811
2812 !! test
2813 External links: www.jpeg.org (bug 554)
2814 !! input
2815 http://www.jpeg.org
2816 !!result
2817 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2818 </p>
2819 !! end
2820
2821 !! test
2822 External links: URL within URL (original bug 2)
2823 !! input
2824 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2825 !! result
2826 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2827 </p>
2828 !! end
2829
2830 !! test
2831 BUG 361: URL inside bracketed URL
2832 !! input
2833 [http://www.example.com/foo http://www.example.com/bar]
2834 !! result
2835 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2836 </p>
2837 !! end
2838
2839 !! test
2840 BUG 361: URL within URL, not bracketed
2841 !! input
2842 http://www.example.com/foo?=http://www.example.com/bar
2843 !! result
2844 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2845 </p>
2846 !! end
2847
2848 !! test
2849 BUG 289: ">"-token in URL-tail
2850 !! input
2851 http://www.example.com/<hello>
2852 !! result
2853 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2854 </p>
2855 !!end
2856
2857 !! test
2858 BUG 289: literal ">"-token in URL-tail
2859 !! input
2860 http://www.example.com/<b>html</b>
2861 !! result
2862 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2863 </p>
2864 !!end
2865
2866 !! test
2867 BUG 289: ">"-token in bracketed URL
2868 !! input
2869 [http://www.example.com/<hello> stuff]
2870 !! result
2871 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2872 </p>
2873 !!end
2874
2875 !! test
2876 BUG 289: literal ">"-token in bracketed URL
2877 !! input
2878 [http://www.example.com/<b>html</b> stuff]
2879 !! result
2880 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2881 </p>
2882 !!end
2883
2884 !! test
2885 BUG 289: literal double quote at end of URL
2886 !! input
2887 http://www.example.com/"hello"
2888 !! result
2889 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2890 </p>
2891 !!end
2892
2893 !! test
2894 BUG 289: literal double quote in bracketed URL
2895 !! input
2896 [http://www.example.com/"hello" stuff]
2897 !! result
2898 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2899 </p>
2900 !!end
2901
2902 !! test
2903 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2904 !! input
2905 [http://www.example.com test]
2906 !! result
2907 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2908 </p>
2909 !! end
2910
2911 !! test
2912 External links: link text with spaces
2913 !! input
2914 [http://www.example.com a b c]
2915 [http://www.example.com ''a'' ''b'']
2916 !! result
2917 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2918 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2919 </p>
2920 !! end
2921
2922 !! test
2923 External links: wiki links within external link (Bug 3695)
2924 !! input
2925 [http://example.com [[wikilink]] embedded in ext link]
2926 !! result
2927 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
2928 </p>
2929 !! end
2930
2931 !! test
2932 BUG 787: Links with one slash after the url protocol are invalid
2933 !! input
2934 http:/example.com
2935
2936 [http:/example.com title]
2937 !! result
2938 <p>http:/example.com
2939 </p><p>[http:/example.com title]
2940 </p>
2941 !! end
2942
2943 !! test
2944 Bracketed external links with template-generated invalid target
2945 !! input
2946 [{{echo|http:/example.com}} title]
2947 !! result
2948 <p>[http:/example.com title]
2949 </p>
2950 !! end
2951
2952 !! test
2953 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2954 !! input
2955 ''[http://example.com text'']
2956 [http://example.com '''text]'''
2957 ''Something [http://example.com in italic'']
2958 ''Something [http://example.com mixed''''', even bold]'''
2959 '''''Now [http://example.com both''''']
2960 !! result
2961 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2962 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2963 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2964 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2965 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2966 </p>
2967 !! end
2968
2969
2970 !! test
2971 Bug 4781: %26 in URL
2972 !! input
2973 http://www.example.com/?title=AT%26T
2974 !! result
2975 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2976 </p>
2977 !! end
2978
2979 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2980 # % is actually legal in HTML5. Any change in output would need testing though.
2981 !! test
2982 Bug 4781, 5267: %25 in URL
2983 !! input
2984 http://www.example.com/?title=100%25_Bran
2985 !! result
2986 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
2987 </p>
2988 !! end
2989
2990 !! test
2991 Bug 4781, 5267: %28, %29 in URL
2992 !! input
2993 http://www.example.com/?title=Ben-Hur_%281959_film%29
2994 !! result
2995 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
2996 </p>
2997 !! end
2998
2999
3000 !! test
3001 Bug 4781: %26 in autonumber URL
3002 !! input
3003 [http://www.example.com/?title=AT%26T]
3004 !! result
3005 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3006 </p>
3007 !! end
3008
3009 !! test
3010 Bug 4781, 5267: %26 in autonumber URL
3011 !! input
3012 [http://www.example.com/?title=100%25_Bran]
3013 !! result
3014 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3015 </p>
3016 !! end
3017
3018 !! test
3019 Bug 4781, 5267: %28, %29 in autonumber URL
3020 !! input
3021 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3022 !! result
3023 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3024 </p>
3025 !! end
3026
3027
3028 !! test
3029 Bug 4781: %26 in bracketed URL
3030 !! input
3031 [http://www.example.com/?title=AT%26T link]
3032 !! result
3033 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3034 </p>
3035 !! end
3036
3037 !! test
3038 Bug 4781, 5267: %26 in bracketed URL
3039 !! input
3040 [http://www.example.com/?title=100%25_Bran link]
3041 !! result
3042 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3043 </p>
3044 !! end
3045
3046 !! test
3047 Bug 4781, 5267: %28, %29 in bracketed URL
3048 !! input
3049 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3050 !! result
3051 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3052 </p>
3053 !! end
3054
3055 !! test
3056 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3057 !! input
3058 Some [http://example.com/ pretty ''italics'' and stuff]!
3059 !! result
3060 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3061 </p>
3062 !! end
3063
3064 !! test
3065 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3066 !! input
3067 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3068 !! result
3069 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
3070 </p>
3071 !! end
3072
3073 !! test
3074 External link containing double-single-quotes with no space separating the url from text in italics
3075 !! input
3076 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
3077 !! result
3078 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
3079 </p>
3080 !! end
3081
3082 !! test
3083 URL-encoding in URL functions (single parameter)
3084 !! input
3085 {{localurl:Some page|amp=&}}
3086 !! result
3087 <p>/index.php?title=Some_page&amp;amp=&amp;
3088 </p>
3089 !! end
3090
3091 !! test
3092 URL-encoding in URL functions (multiple parameters)
3093 !! input
3094 {{localurl:Some page|q=?&amp=&}}
3095 !! result
3096 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3097 </p>
3098 !! end
3099
3100 !! test
3101 Brackets in urls
3102 !! input
3103 http://example.com/index.php?foozoid%5B%5D=bar
3104
3105 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3106 !! result
3107 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3108 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3109 </p>
3110 !! end
3111
3112 !! test
3113 IPv6 urls (bug 21261)
3114 !! options
3115 disabled
3116 !! input
3117 http://[2404:130:0:1000::187:2]/index.php
3118 !! result
3119 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
3120 </p>
3121 !! end
3122
3123 !! test
3124 Non-extlinks in brackets
3125 !! input
3126 [foo]
3127 [foo bar]
3128 [foo ''bar'']
3129 [fool's] errand
3130 [fool's errand]
3131 [{{echo|foo}}]
3132 [{{echo|foo}} bar]
3133 [{{echo|foo}} ''bar'']
3134 [{{echo|foo}}l's] errand
3135 [{{echo|foo}}l's errand]
3136 [url={{echo|foo}}]
3137 [url=http://example.com]
3138 !! result
3139 <p>[foo]
3140 [foo bar]
3141 [foo <i>bar</i>]
3142 [fool's] errand
3143 [fool's errand]
3144 [foo]
3145 [foo bar]
3146 [foo <i>bar</i>]
3147 [fool's] errand
3148 [fool's errand]
3149 [url=foo]
3150 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3151 </p>
3152 !! end
3153
3154 ###
3155 ### Quotes
3156 ###
3157
3158 !! test
3159 Quotes
3160 !! input
3161 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3162
3163 Normal text. '''''Bold italic text.''''' Normal text.
3164 !!result
3165 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3166 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3167 </p>
3168 !! end
3169
3170
3171 !! test
3172 Unclosed and unmatched quotes (php)
3173 !! options
3174 php
3175 !! input
3176 '''''Bold italic text '''with bold deactivated''' in between.'''''
3177
3178 '''''Bold italic text ''with italic deactivated'' in between.'''''
3179
3180 '''Bold text..
3181
3182 ..spanning two paragraphs (should not work).'''
3183
3184 '''Bold tag left open
3185
3186 ''Italic tag left open
3187
3188 Normal text.
3189
3190 <!-- Unmatching number of opening, closing tags: -->
3191 '''This year''''s election ''should'' beat '''last year''''s.
3192
3193 ''Tom'''s car is bigger than ''Susan'''s.
3194
3195 Plain ''italic'''s plain
3196 !! result
3197 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3198 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3199 </p><p><b>Bold text..</b>
3200 </p><p>..spanning two paragraphs (should not work).
3201 </p><p><b>Bold tag left open</b>
3202 </p><p><i>Italic tag left open</i>
3203 </p><p>Normal text.
3204 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3205 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3206 </p><p>Plain <i>italic'</i>s plain
3207 </p>
3208 !! end
3209 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3210 # parser strips. The wikitext contains just the first half of the bold
3211 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3212 # differently than the PHP parser.)
3213 !! test
3214 Unclosed and unmatched quotes (parsoid)
3215 !! options
3216 parsoid
3217 !! input
3218 '''''Bold italic text '''with bold deactivated''' in between.'''''
3219
3220 '''''Bold italic text ''with italic deactivated'' in between.'''''
3221
3222 '''Bold text..
3223
3224 ..spanning two paragraphs (should not work).'''
3225
3226 '''Bold tag left open
3227
3228 ''Italic tag left open
3229
3230 Normal text.
3231
3232 <!-- Unmatching number of opening, closing tags: -->
3233 '''This year''''s election ''should'' beat '''last year''''s.
3234
3235 ''Tom'''s car is bigger than ''Susan'''s.
3236
3237 Plain ''italic'''s plain
3238 !! result
3239 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3240 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3241 </p><p><b>Bold text..</b>
3242 </p><p>..spanning two paragraphs (should not work).<b></b>
3243 </p><p><b>Bold tag left open</b>
3244 </p><p><i>Italic tag left open</i>
3245 </p><p>Normal text.
3246 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3247 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3248 </p><p>Plain <i>italic'</i>s plain
3249 </p>
3250 !! end
3251
3252 ###
3253 ### Tables
3254 ###
3255 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3256 ###
3257
3258 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3259 # is the bare minimun required by the spec, see:
3260 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3261 !! test
3262 A table with no data. (php)
3263 !! options
3264 php
3265 !! input
3266 {||}
3267 !! result
3268 !! end
3269 # Parsoid team replies: empty table tags are legal in HTML5
3270 !! test
3271 A table with no data. (parsoid)
3272 !! options
3273 parsoid
3274 !! input
3275 {||}
3276 !! result
3277 <table></table>
3278 !! end
3279
3280 # A table with nothing but a caption is invalid XHTML, we might want to render
3281 # this as <p>caption</p>
3282 !! test
3283 A table with nothing but a caption (php)
3284 !! options
3285 php
3286 !! input
3287 {|
3288 |+ caption
3289 |}
3290 !! result
3291 <table>
3292 <caption> caption
3293 </caption><tr><td></td></tr></table>
3294
3295 !! end
3296 # Parsoid team replies: table with only a caption is legal in HTML5
3297 !! test
3298 A table with nothing but a caption (parsoid)
3299 !! options
3300 parsoid
3301 !! input
3302 {|
3303 |+ caption
3304 |}
3305 !! result
3306 <table><caption> caption</caption></table>
3307 !! end
3308
3309 !! test
3310 A table with caption with default-spaced attributes and a table row
3311 !! input
3312 {|
3313 |+ style="color: red;" | caption1
3314 |-
3315 | foo
3316 |}
3317 !! result
3318 <table>
3319 <caption style="color: red;"> caption1
3320 </caption>
3321 <tr>
3322 <td> foo
3323 </td></tr></table>
3324
3325 !! end
3326
3327 !! test
3328 A table with captions with non-default spaced attributes and a table row
3329 !! input
3330 {|
3331 |+style="color: red;"|caption2
3332 |+ style="color: red;"| caption3
3333 |-
3334 | foo
3335 |}
3336 !! result
3337 <table>
3338 <caption style="color: red;">caption2
3339 </caption>
3340 <caption style="color: red;"> caption3
3341 </caption>
3342 <tr>
3343 <td> foo
3344 </td></tr></table>
3345
3346 !! end
3347
3348 !! test
3349 Table td-cell syntax variations
3350 !! input
3351 {|
3352 | foo bar foo | baz
3353 | foo bar foo || baz
3354 | style='color:red;' | baz
3355 | style='color:red;' || baz
3356 |}
3357 !! result
3358 <table>
3359 <tr>
3360 <td> baz
3361 </td>
3362 <td> foo bar foo </td>
3363 <td> baz
3364 </td>
3365 <td style="color:red;"> baz
3366 </td>
3367 <td> style='color:red;' </td>
3368 <td> baz
3369 </td></tr></table>
3370
3371 !! end
3372
3373 !! test
3374 Simple table
3375 !! input
3376 {|
3377 | 1 || 2
3378 |-
3379 | 3 || 4
3380 |}
3381 !! result
3382 <table>
3383 <tr>
3384 <td> 1 </td>
3385 <td> 2
3386 </td></tr>
3387 <tr>
3388 <td> 3 </td>
3389 <td> 4
3390 </td></tr></table>
3391
3392 !! end
3393
3394 !! test
3395 Simple table but with multiple dashes for row wikitext
3396 !! input
3397 {|
3398 | foo
3399 |-----
3400 | bar
3401 |}
3402 !! result
3403 <table>
3404 <tr>
3405 <td> foo
3406 </td></tr>
3407 <tr>
3408 <td> bar
3409 </td></tr></table>
3410
3411 !! end
3412 !! test
3413 Multiplication table
3414 !! input
3415 {| border="1" cellpadding="2"
3416 |+Multiplication table
3417 |-
3418 ! &times; !! 1 !! 2 !! 3
3419 |-
3420 ! 1
3421 | 1 || 2 || 3
3422 |-
3423 ! 2
3424 | 2 || 4 || 6
3425 |-
3426 ! 3
3427 | 3 || 6 || 9
3428 |-
3429 ! 4
3430 | 4 || 8 || 12
3431 |-
3432 ! 5
3433 | 5 || 10 || 15
3434 |}
3435 !! result
3436 <table border="1" cellpadding="2">
3437 <caption>Multiplication table
3438 </caption>
3439 <tr>
3440 <th> &#215; </th>
3441 <th> 1 </th>
3442 <th> 2 </th>
3443 <th> 3
3444 </th></tr>
3445 <tr>
3446 <th> 1
3447 </th>
3448 <td> 1 </td>
3449 <td> 2 </td>
3450 <td> 3
3451 </td></tr>
3452 <tr>
3453 <th> 2
3454 </th>
3455 <td> 2 </td>
3456 <td> 4 </td>
3457 <td> 6
3458 </td></tr>
3459 <tr>
3460 <th> 3
3461 </th>
3462 <td> 3 </td>
3463 <td> 6 </td>
3464 <td> 9
3465 </td></tr>
3466 <tr>
3467 <th> 4
3468 </th>
3469 <td> 4 </td>
3470 <td> 8 </td>
3471 <td> 12
3472 </td></tr>
3473 <tr>
3474 <th> 5
3475 </th>
3476 <td> 5 </td>
3477 <td> 10 </td>
3478 <td> 15
3479 </td></tr></table>
3480
3481 !! end
3482
3483 !! test
3484 Accept "||" in table headings
3485 !! input
3486 {|
3487 !h1 || h2
3488 |}
3489 !! result
3490 <table>
3491 <tr>
3492 <th>h1 </th>
3493 <th> h2
3494 </th></tr></table>
3495
3496 !! end
3497
3498 !! test
3499 Accept "||" in indented table headings
3500 !! input
3501 :{|
3502 !h1 || h2
3503 |}
3504 !! result
3505 <dl><dd><table>
3506 <tr>
3507 <th>h1 </th>
3508 <th> h2
3509 </th></tr></table></dd></dl>
3510
3511 !! end
3512
3513 !! test
3514 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3515 !! input
3516 {|
3517 !| h1
3518 || a
3519 |}
3520 !! result
3521 <table>
3522 <tr>
3523 <th> h1
3524 </th>
3525 <td> a
3526 </td></tr></table>
3527
3528 !! end
3529
3530 !!test
3531 Accept "| !" at start of line in tables (ignore !-attribute)
3532 !!input
3533 {|
3534 |-
3535 | !style="color:red" | bar
3536 |}
3537 !!result
3538 <table>
3539
3540 <tr>
3541 <td> bar
3542 </td></tr></table>
3543
3544 !!end
3545
3546 !!test
3547 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3548 !!input
3549 {|
3550 |-
3551 |style='color:red;'|+1
3552 |style='color:blue;'|-1
3553 |-
3554 | 1 || 2 || 3
3555 | 1 ||+2 ||-3
3556 |-
3557 | +1
3558 | -1
3559 |}
3560 !!result
3561 <table>
3562
3563 <tr>
3564 <td style="color:red;">+1
3565 </td>
3566 <td style="color:blue;">-1
3567 </td></tr>
3568 <tr>
3569 <td> 1 </td>
3570 <td> 2 </td>
3571 <td> 3
3572 </td>
3573 <td> 1 </td>
3574 <td>+2 </td>
3575 <td>-3
3576 </td></tr>
3577 <tr>
3578 <td> +1
3579 </td>
3580 <td> -1
3581 </td></tr></table>
3582
3583 !!end
3584
3585 !! test
3586 Table rowspan
3587 !! input
3588 {| border=1
3589 | Cell 1, row 1
3590 |rowspan=2| Cell 2, row 1 (and 2)
3591 | Cell 3, row 1
3592 |-
3593 | Cell 1, row 2
3594 | Cell 3, row 2
3595 |}
3596 !! result
3597 <table border="1">
3598 <tr>
3599 <td> Cell 1, row 1
3600 </td>
3601 <td rowspan="2"> Cell 2, row 1 (and 2)
3602 </td>
3603 <td> Cell 3, row 1
3604 </td></tr>
3605 <tr>
3606 <td> Cell 1, row 2
3607 </td>
3608 <td> Cell 3, row 2
3609 </td></tr></table>
3610
3611 !! end
3612
3613 !! test
3614 Nested table
3615 !! input
3616 {| border=1
3617 | &alpha;
3618 |
3619 {| bgcolor=#ABCDEF border=2
3620 |nested
3621 |-
3622 |table
3623 |}
3624 |the original table again
3625 |}
3626 !! result
3627 <table border="1">
3628 <tr>
3629 <td> &#945;
3630 </td>
3631 <td>
3632 <table bgcolor="#ABCDEF" border="2">
3633 <tr>
3634 <td>nested
3635 </td></tr>
3636 <tr>
3637 <td>table
3638 </td></tr></table>
3639 </td>
3640 <td>the original table again
3641 </td></tr></table>
3642
3643 !! end
3644
3645 !! test
3646 Invalid attributes in table cell (bug 1830)
3647 !! input
3648 {|
3649 |Cell:|broken
3650 |}
3651 !! result
3652 <table>
3653 <tr>
3654 <td>broken
3655 </td></tr></table>
3656
3657 !! end
3658
3659
3660 !! test
3661 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3662 !! input
3663 {|
3664 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3665 !! result
3666 <table>
3667 <tr>
3668 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3669 <td>]" onmouseover="alert(document.cookie)"&gt;test
3670 </td>
3671 </tr>
3672 </table>
3673
3674 !! end
3675
3676
3677 !! test
3678 Indented table markup mixed with indented pre content (proposed in bug 6200)
3679 !! input
3680 <table>
3681 <tr>
3682 <td>
3683 Text that should be rendered preformatted
3684 </td>
3685 </tr>
3686 </table>
3687 !! result
3688 <table>
3689 <tr>
3690 <td>
3691 <pre>Text that should be rendered preformatted
3692 </pre>
3693 </td>
3694 </tr>
3695 </table>
3696
3697 !! end
3698
3699 !! test
3700 Template-generated table cell attributes and cell content
3701 !! input
3702 {|
3703 |{{table_attribs}}
3704 |}
3705 !! result
3706 <table>
3707 <tr>
3708 <td style="color: red"> Foo
3709 </td></tr></table>
3710
3711 !! end
3712
3713 !! test
3714 Table with row followed by newlines and table heading
3715 !! input
3716 {|
3717 |-
3718
3719 ! foo
3720 |}
3721 !! result
3722 <table>
3723
3724
3725 <tr>
3726 <th> foo
3727 </th></tr></table>
3728
3729 !! end
3730
3731 !! test
3732 Table with empty line following the start tag
3733 !! input
3734 {|
3735
3736 |-
3737 | foo
3738 |}
3739 !! result
3740 <table>
3741
3742
3743 <tr>
3744 <td> foo
3745 </td></tr></table>
3746
3747 !! end
3748
3749 # FIXME: Preserve the attribute properly (with an empty string as value) in
3750 # the PHP parser. Parsoid implements the behavior below.
3751 !! test
3752 Table attributes with empty value
3753 !! options
3754 parsoid
3755 !! input
3756 {|
3757 | style=| hello
3758 |}
3759 !! result
3760 <table>
3761 <tbody>
3762 <tr>
3763 <td style=""> hello
3764 </td></tr></tbody></table>
3765
3766 !! end
3767
3768 !! test
3769 Wikitext table with a lot of comments
3770 !! input
3771 {|
3772 <!-- c0 -->
3773 | foo
3774 <!-- c1 -->
3775 |- <!-- c2 -->
3776 <!-- c3 -->
3777 |<!-- c4 -->
3778 <!-- c5 -->
3779 |}
3780 !! result
3781 <table>
3782 <tr>
3783 <td> foo
3784 </td></tr>
3785 <tr>
3786 <td>
3787 </td></tr></table>
3788
3789 !! end
3790
3791 !! test
3792 Wikitext table with double-line table cell
3793 !! input
3794 {|
3795 |a
3796 b
3797 |}
3798 !! result
3799 <table>
3800 <tr>
3801 <td>a
3802 <p>b
3803 </p>
3804 </td></tr></table>
3805
3806 !! end
3807
3808 !! test
3809 Table cell with a single comment
3810 !! input
3811 {|
3812 | <!-- c1 -->
3813 | a
3814 |}
3815 !! result
3816 <table>
3817 <tr>
3818 <td>
3819 </td>
3820 <td> a
3821 </td></tr></table>
3822
3823 !! end
3824
3825 # The expected HTML structure in this test is debatable. The PHP parser does
3826 # not parse this kind of table at all. The main focus for Parsoid is on
3827 # round-tripping, so this output is ok for now. TODO: revisit!
3828 !! test
3829 Wikitext table with html-syntax row (Parsoid)
3830 !! options
3831 parsoid
3832 !! input
3833 {|
3834 |-
3835 <td>foo</td>
3836 |}
3837 !! result
3838 <table>
3839 <tbody>
3840 <tr>
3841 <td>foo</td></tr></tbody></table>
3842 !! end
3843
3844 ###
3845 ### Internal links
3846 ###
3847 !! test
3848 Plain link, capitalized
3849 !! input
3850 [[Main Page]]
3851 !! result
3852 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3853 </p>
3854 !! end
3855
3856 !! test
3857 Plain link, uncapitalized
3858 !! input
3859 [[main Page]]
3860 !! result
3861 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3862 </p>
3863 !! end
3864
3865 !! test
3866 Piped link
3867 !! input
3868 [[Main Page|The Main Page]]
3869 !! result
3870 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3871 </p>
3872 !! end
3873
3874 !! test
3875 Broken link
3876 !! input
3877 [[Zigzagzogzagzig]]
3878 !! result
3879 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3880 </p>
3881 !! end
3882
3883 !! test
3884 Broken link with fragment
3885 !! input
3886 [[Zigzagzogzagzig#zug]]
3887 !! result
3888 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3889 </p>
3890 !! end
3891
3892 !! test
3893 Special page link with fragment
3894 !! input
3895 [[Special:Version#anchor]]
3896 !! result
3897 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3898 </p>
3899 !! end
3900
3901 !! test
3902 Nonexistent special page link with fragment
3903 !! input
3904 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3905 !! result
3906 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3907 </p>
3908 !! end
3909
3910 !! test
3911 Link with prefix
3912 !! input
3913 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3914 !! result
3915 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3916 </p>
3917 !! end
3918
3919 !! test
3920 Link with suffix
3921 !! input
3922 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3923 !! result
3924 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
3925 </p>
3926 !! end
3927
3928 !! article
3929 prefixed article
3930 !! text
3931 Some text
3932 !! endarticle
3933
3934 !! test
3935 Bug 43661: Piped links with identical prefixes
3936 !! input
3937 [[prefixed article|prefixed articles with spaces]]
3938
3939 [[prefixed article|prefixed articlesaoeu]]
3940
3941 [[Main Page|Main Page test]]
3942 !! result
3943 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3944 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3945 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3946 </p>
3947 !! end
3948
3949
3950 !! test
3951 Link with HTML entity in suffix / tail
3952 !! input
3953 [[Main Page]]&quot;, [[Main Page]]&#97;
3954 !! result
3955 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3956 </p>
3957 !! end
3958
3959 !! test
3960 Link with 3 brackets
3961 !! input
3962 [[[main page]]]
3963 !! result
3964 <p>[[[main page]]]
3965 </p>
3966 !! end
3967
3968 !! test
3969 Piped link with 3 brackets
3970 !! input
3971 [[[main page|the main page]]]
3972 !! result
3973 <p>[[[main page|the main page]]]
3974 </p>
3975 !! end
3976
3977 !! test
3978 Link with multiple pipes
3979 !! input
3980 [[Main Page|The|Main|Page]]
3981 !! result
3982 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3983 </p>
3984 !! end
3985
3986 !! test
3987 Link to namespaces
3988 !! input
3989 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3990 !! result
3991 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
3992 </p>
3993 !! end
3994
3995 !! test
3996 Piped link to namespace
3997 !! input
3998 [[Meta:Disclaimers|The disclaimers]]
3999 !! result
4000 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
4001 </p>
4002 !! end
4003
4004 !! test
4005 Link containing }
4006 !! input
4007 [[Usually caused by a typo (oops}]]
4008 !! result
4009 <p>[[Usually caused by a typo (oops}]]
4010 </p>
4011 !! end
4012
4013 !! test
4014 Link containing % (not as a hex sequence)
4015 !! input
4016 [[7% Solution]]
4017 !! result
4018 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
4019 </p>
4020 !! end
4021
4022 !! test
4023 Link containing % as a single hex sequence interpreted to char
4024 !! input
4025 [[7%25 Solution]]
4026 !! result
4027 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
4028 </p>
4029 !!end
4030
4031 !! test
4032 Link containing % as a double hex sequence interpreted to hex sequence
4033 !! input
4034 [[7%2525 Solution]]
4035 !! result
4036 <p>[[7%2525 Solution]]
4037 </p>
4038 !!end
4039
4040 !! test
4041 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4042 Example for such a section: == < ==
4043 !! input
4044 [[%23%3c]][[%23%3e]]
4045 !! result
4046 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4047 </p>
4048 !! end
4049
4050 !! test
4051 Link containing "<#" and ">#" as a hex sequences
4052 !! input
4053 [[%3c%23]][[%3e%23]]
4054 !! result
4055 <p>[[%3c%23]][[%3e%23]]
4056 </p>
4057 !! end
4058
4059 !! test
4060 Link containing an equals sign
4061 !! input
4062 [[Special:BookSources/isbn=4-00-026157-6]]
4063 !! result
4064 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
4065 </p>
4066 !! end
4067
4068 !! article
4069 Foo~bar
4070 !! text
4071 Just a test of an article title containing a tilde.
4072 !! endarticle
4073
4074 # note that links containing signatures, like [[Foo~~~~]], are
4075 # massaged by the pre-save transform (PST) and so the tildes are never
4076 # seen by the parser.
4077 !! test
4078 Link containing a tilde
4079 !! input
4080 [[Foo~bar]]
4081 !! result
4082 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4083 </p>
4084 !! end
4085
4086 !! test
4087 Link containing double-single-quotes '' (bug 4598)
4088 !! input
4089 [[Lista d''e paise d''o munno]]
4090 !! result
4091 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
4092 </p>
4093 !! end
4094
4095 !! test
4096 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4097 !! input
4098 Some [[Link|pretty ''italics'' and stuff]]!
4099 !! result
4100 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
4101 </p>
4102 !! end
4103
4104 !! test
4105 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4106 !! input
4107 ''Some [[Link|pretty ''italics'' and stuff]]!
4108 !! result
4109 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
4110 </p>
4111 !! end
4112
4113 !! test
4114 Link with double quotes in title part (literal) and alternate part (interpreted)
4115 !! input
4116 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4117
4118 [[''Pentecoste'']]
4119
4120 [[''Pentecoste''|Pentecoste]]
4121
4122 [[''Pentecoste''|''Pentecoste'']]
4123 !! result
4124 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
4125 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
4126 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
4127 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
4128 </p>
4129 !! end
4130
4131 !! test
4132 Broken image links with HTML captions (bug 39700)
4133 !! input
4134 [[File:Nonexistent|<script></script>]]
4135 [[File:Nonexistent|100px|<script></script>]]
4136 [[File:Nonexistent|&lt;]]
4137 [[File:Nonexistent|a<i>b</i>c]]
4138 !! result
4139 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4140 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4141 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4142 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4143 </p>
4144 !! end
4145
4146 !! test
4147 Plain link to URL
4148 !! input
4149 [[http://www.example.com]]
4150 !! result
4151 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4152 </p>
4153 !! end
4154
4155 !! test
4156 Plain link to URL with link text
4157 !! input
4158 [[http://www.example.com Link text]]
4159 !! result
4160 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4161 </p>
4162 !! end
4163
4164 !! test
4165 Plain link to protocol-relative URL
4166 !! input
4167 [[//www.example.com]]
4168 !! result
4169 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4170 </p>
4171 !! end
4172
4173 !! test
4174 Plain link to protocol-relative URL with link text
4175 !! input
4176 [[//www.example.com Link text]]
4177 !! result
4178 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4179 </p>
4180 !! end
4181
4182 !! test
4183 Plain link to page with question mark in title
4184 !! input
4185 [[A?b]]
4186
4187 [[A?b|Baz]]
4188 !! result
4189 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4190 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4191 </p>
4192 !! end
4193
4194
4195 # I'm fairly sure the expected result here is wrong.
4196 # We want these to be URL links, not pseudo-pages with URLs for titles....
4197 # However the current output is also pretty screwy.
4198 #
4199 # ----
4200 # I'm changing it to match the current output--it arguably makes more
4201 # sense in the light of the test above. Old expected result was:
4202 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4203 #</p>
4204 # But I think this test is bordering on "garbage in, garbage out" anyway.
4205 # -- wtm
4206 !! test
4207 Piped link to URL
4208 !! input
4209 Piped link to URL: [[http://www.example.com|an example URL]]
4210 !! result
4211 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4212 </p>
4213 !! end
4214
4215 !! test
4216 BUG 2: [[page|http://url/]] should link to page, not http://url/
4217 !! input
4218 [[Main Page|http://url/]]
4219 !! result
4220 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4221 </p>
4222 !! end
4223
4224 !! test
4225 BUG 337: Escaped self-links should be bold
4226 !! options
4227 title=[[Bug462]]
4228 !! input
4229 [[Bu&#103;462]] [[Bug462]]
4230 !! result
4231 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4232 </p>
4233 !! end
4234
4235 !! test
4236 Self-link to section should not be bold
4237 !! options
4238 title=[[Main Page]]
4239 !! input
4240 [[Main Page#section]]
4241 !! result
4242 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4243 </p>
4244 !! end
4245
4246 !! article
4247 00
4248 !! text
4249 This is 00.
4250 !! endarticle
4251
4252 !!test
4253 Self-link to numeric title
4254 !!options
4255 title=[[0]]
4256 !!input
4257 [[0]]
4258 !!result
4259 <p><strong class="selflink">0</strong>
4260 </p>
4261 !!end
4262
4263 !!test
4264 Link to numeric-equivalent title
4265 !!options
4266 title=[[0]]
4267 !!input
4268 [[00]]
4269 !!result
4270 <p><a href="/wiki/00" title="00">00</a>
4271 </p>
4272 !!end
4273
4274 !! test
4275 <nowiki> inside a link
4276 !! input
4277 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4278 !! result
4279 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4280 </p>
4281 !! end
4282
4283 !! test
4284 Non-breaking spaces in title
4285 !! input
4286 [[&nbsp; Main &nbsp; Page &nbsp;]]
4287 !! result
4288 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4289 </p>
4290 !!end
4291
4292 !! test
4293 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4294 !! options
4295 language=ca
4296 !! input
4297 '''[[Main Page]]'''
4298 !! result
4299 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4300 </p>
4301 !! end
4302
4303 !! test
4304 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4305 !! options
4306 language=ca
4307 !! input
4308 ''[[Main Page]]''
4309 !! result
4310 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4311 </p>
4312 !! end
4313
4314 !! test
4315 Internal link with en linktrail: no apostrophes (bug 27473)
4316 !! options
4317 language=en
4318 !! input
4319 [[Something]]'nice
4320 !! result
4321 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4322 </p>
4323 !! end
4324
4325 !! test
4326 Internal link with ca linktrail with apostrophes (bug 27473)
4327 !! options
4328 language=ca
4329 !! input
4330 [[Something]]'nice
4331 !! result
4332 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4333 </p>
4334 !! end
4335
4336 !! test
4337 Internal link with kaa linktrail with apostrophes (bug 27473)
4338 !! options
4339 language=kaa
4340 !! input
4341 [[Something]]'nice
4342 !! result
4343 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
4344 </p>
4345 !! end
4346
4347 !! article
4348 Söfnuður
4349 !! text
4350 Test.
4351 !! endarticle
4352
4353 !! test
4354 Internal link with is link prefix
4355 !! options
4356 language=is
4357 !! input
4358 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4359 !! result
4360 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4361 </p>
4362 !! end
4363
4364 !! article
4365 Mótmælendatrú
4366 !! text
4367 Test.
4368 !! endarticle
4369
4370 !! test
4371 Internal link with is link trail and link prefix
4372 !! options
4373 language=is
4374 !! input
4375 [[mótmælendatrú|xxx]]ar
4376 [[mótmælendatrú]]ar
4377 mótmælenda[[söfnuður]]
4378 mótmælenda[[söfnuður|söfnuðir]]
4379 mótmælenda[[söfnuður|söfnuðir]]xxx
4380 !! result
4381 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4382 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4383 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4384 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4385 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4386 </p>
4387 !! end
4388
4389 !! test
4390 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4391 !! input
4392 [[Foo| bar]]
4393
4394 [[Foo| ''bar'']]
4395
4396 [http://wp.org foo]
4397
4398 [http://wp.org ''foo'']
4399 !! result
4400 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4401 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
4402 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4403 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4404 </p>
4405 !! end
4406
4407 ###
4408 ### Interwiki links (see maintenance/interwiki.sql)
4409 ###
4410
4411 !! test
4412 Inline interwiki link
4413 !! input
4414 [[MeatBall:SoftSecurity]]
4415 !! result
4416 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4417 </p>
4418 !! end
4419
4420 !! test
4421 Inline interwiki link with empty title (bug 2372)
4422 !! input
4423 [[MeatBall:]]
4424 !! result
4425 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4426 </p>
4427 !! end
4428
4429 !! test
4430 Interwiki link encoding conversion (bug 1636)
4431 !! input
4432 *[[Wikipedia:ro:Olteni&#0355;a]]
4433 *[[Wikipedia:ro:Olteni&#355;a]]
4434 !! result
4435 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4436 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4437 </li></ul>
4438
4439 !! end
4440
4441 !! test
4442 Interwiki link with fragment (bug 2130)
4443 !! input
4444 [[MeatBall:SoftSecurity#foo]]
4445 !! result
4446 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4447 </p>
4448 !! end
4449
4450 !! test
4451 Interlanguage link
4452 !! input
4453 Blah blah blah
4454 [[zh:Chinese]]
4455 !!result
4456 <p>Blah blah blah
4457 </p>
4458 !! end
4459
4460 !! test
4461 Double interlanguage link
4462 !! input
4463 Blah blah blah
4464 [[es:Spanish]]
4465 [[zh:Chinese]]
4466 !!result
4467 <p>Blah blah blah
4468 </p>
4469 !! end
4470
4471 !! test
4472 Interlanguage link, with prefix links
4473 !! options
4474 language=ln
4475 !! input
4476 Blah blah blah
4477 [[zh:Chinese]]
4478 !!result
4479 <p>Blah blah blah
4480 </p>
4481 !! end
4482
4483 !! test
4484 Double interlanguage link, with prefix links (bug 8897)
4485 !! options
4486 language=ln
4487 !! input
4488 Blah blah blah
4489 [[es:Spanish]]
4490 [[zh:Chinese]]
4491 !!result
4492 <p>Blah blah blah
4493 </p>
4494 !! end
4495
4496 !! test
4497 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4498 !! options
4499 language=ln
4500 !! input
4501 [[WW&nbsp;II]]
4502 !!result
4503 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
4504 </p>
4505 !! end
4506
4507 ##
4508 ## XHTML tidiness
4509 ###
4510
4511 !! test
4512 <br> to <br />
4513 !! input
4514 1<br>2<br />3
4515 !! result
4516 <p>1<br />2<br />3
4517 </p>
4518 !! end
4519
4520 !! test
4521 Broken br tag sanitization
4522 !! input
4523 </br>
4524 !! result
4525 <p>&lt;/br&gt;
4526 </p>
4527 !! end
4528
4529 !! test
4530 Incorrecly removing closing slashes from correctly formed XHTML
4531 !! input
4532 <br style="clear:both;" />
4533 !! result
4534 <p><br style="clear:both;" />
4535 </p>
4536 !! end
4537
4538 !! test
4539 Failing to transform badly formed HTML into correct XHTML
4540 !! input
4541 <br style="clear: left;">
4542 <br style="clear: right;">
4543 <br style="clear: both;">
4544 !! result
4545 <p><br style="clear: left;" />
4546 <br style="clear: right;" />
4547 <br style="clear: both;" />
4548 </p>
4549 !!end
4550
4551 !! test
4552 Handling html with a div self-closing tag
4553 !! input
4554 <div title />
4555 <div title/>
4556 <div title/ >
4557 <div title=bar />
4558 <div title=bar/>
4559 <div title=bar/ >
4560 !! result
4561 <p>&lt;div title /&gt;
4562 &lt;div title/&gt;
4563 </p>
4564 <div>
4565 <p>&lt;div title=bar /&gt;
4566 &lt;div title=bar/&gt;
4567 </p>
4568 <div title="bar/"></div>
4569 </div>
4570
4571 !! end
4572
4573 !! test
4574 Handling html with a br self-closing tag
4575 !! input
4576 <br title />
4577 <br title/>
4578 <br title/ >
4579 <br title=bar />
4580 <br title=bar/>
4581 <br title=bar/ >
4582 !! result
4583 <p><br title="title" />
4584 <br title="title" />
4585 <br />
4586 <br title="bar" />
4587 <br title="bar" />
4588 <br title="bar/" />
4589 </p>
4590 !! end
4591
4592 !! test
4593 Horizontal ruler (should it add that extra space?)
4594 !! input
4595 <hr>
4596 <hr >
4597 foo <hr
4598 > bar
4599 !! result
4600 <hr />
4601 <hr />
4602 foo <hr /> bar
4603
4604 !! end
4605
4606 !! test
4607 Horizontal ruler -- 4+ dashes render hr
4608 !! input
4609 ----
4610 !! result
4611 <hr />
4612
4613 !! end
4614
4615 !! test
4616 Horizontal ruler -- eats additional dashes on the same line
4617 !! input
4618 ---------
4619 !! result
4620 <hr />
4621
4622 !! end
4623
4624 !! test
4625 Horizontal ruler -- does not collapse dashes on consecutive lines
4626 !! input
4627 ----
4628 ----
4629 !! result
4630 <hr />
4631 <hr />
4632
4633 !! end
4634
4635 !! test
4636 Horizontal ruler -- <4 dashes render as plain text
4637 !! input
4638 ---
4639 !! result
4640 <p>---
4641 </p>
4642 !! end
4643
4644 !! test
4645 Horizontal ruler -- Supports content following dashes on same line
4646 !! input
4647 ---- Foo
4648 !! result
4649 <hr /> Foo
4650
4651 !! end
4652
4653 ###
4654 ### Block-level elements
4655 ###
4656 !! test
4657 Common list
4658 !! input
4659 *Common list
4660 * item 2
4661 *item 3
4662 !! result
4663 <ul><li>Common list
4664 </li><li> item 2
4665 </li><li>item 3
4666 </li></ul>
4667
4668 !! end
4669
4670 !! test
4671 Numbered list
4672 !! input
4673 #Numbered list
4674 #item 2
4675 # item 3
4676 !! result
4677 <ol><li>Numbered list
4678 </li><li>item 2
4679 </li><li> item 3
4680 </li></ol>
4681
4682 !! end
4683
4684 !! test
4685 Mixed list
4686 !! input
4687 *Mixed list
4688 *# with numbers
4689 ** and bullets
4690 *# and numbers
4691 *bullets again
4692 **bullet level 2
4693 ***bullet level 3
4694 ***#Number on level 4
4695 **bullet level 2
4696 **#Number on level 3
4697 **#Number on level 3
4698 *#number level 2
4699 *Level 1
4700 *** Level 3
4701 #** Level 3, but ordered
4702 !! result
4703 <ul><li>Mixed list
4704 <ol><li> with numbers
4705 </li></ol>
4706 <ul><li> and bullets
4707 </li></ul>
4708 <ol><li> and numbers
4709 </li></ol>
4710 </li><li>bullets again
4711 <ul><li>bullet level 2
4712 <ul><li>bullet level 3
4713 <ol><li>Number on level 4
4714 </li></ol>
4715 </li></ul>
4716 </li><li>bullet level 2
4717 <ol><li>Number on level 3
4718 </li><li>Number on level 3
4719 </li></ol>
4720 </li></ul>
4721 <ol><li>number level 2
4722 </li></ol>
4723 </li><li>Level 1
4724 <ul><li><ul><li> Level 3
4725 </li></ul>
4726 </li></ul>
4727 </li></ul>
4728 <ol><li><ul><li><ul><li> Level 3, but ordered
4729 </li></ul>
4730 </li></ul>
4731 </li></ol>
4732
4733 !! end
4734
4735 !! test
4736 Nested lists 1
4737 !! input
4738 *foo
4739 **bar
4740 !! result
4741 <ul><li>foo
4742 <ul><li>bar
4743 </li></ul>
4744 </li></ul>
4745
4746 !! end
4747
4748 !! test
4749 Nested lists 2
4750 !! input
4751 **foo
4752 *bar
4753 !! result
4754 <ul><li><ul><li>foo
4755 </li></ul>
4756 </li><li>bar
4757 </li></ul>
4758
4759 !! end
4760
4761 !! test
4762 Nested lists 3 (first element empty)
4763 !! input
4764 *
4765 **bar
4766 !! result
4767 <ul><li>
4768 <ul><li>bar
4769 </li></ul>
4770 </li></ul>
4771
4772 !! end
4773
4774 !! test
4775 Nested lists 4 (first element empty)
4776 !! input
4777 **
4778 *bar
4779 !! result
4780 <ul><li><ul><li>
4781 </li></ul>
4782 </li><li>bar
4783 </li></ul>
4784
4785 !! end
4786
4787 !! test
4788 Nested lists 5 (both elements empty)
4789 !! input
4790 **
4791 *
4792 !! result
4793 <ul><li><ul><li>
4794 </li></ul>
4795 </li><li>
4796 </li></ul>
4797
4798 !! end
4799
4800 !! test
4801 Nested lists 6 (both elements empty)
4802 !! input
4803 *
4804 **
4805 !! result
4806 <ul><li>
4807 <ul><li>
4808 </li></ul>
4809 </li></ul>
4810
4811 !! end
4812
4813 !! test
4814 Nested lists 7 (skip initial nesting levels)
4815 !! input
4816 *** foo
4817 !! result
4818 <ul><li><ul><li><ul><li> foo
4819 </li></ul>
4820 </li></ul>
4821 </li></ul>
4822
4823 !! end
4824
4825 !! test
4826 Nested lists 8 (multiple nesting transitions)
4827 !! input
4828 * foo
4829 *** bar
4830 ** baz
4831 * boo
4832 !! result
4833 <ul><li> foo
4834 <ul><li><ul><li> bar
4835 </li></ul>
4836 </li><li> baz
4837 </li></ul>
4838 </li><li> boo
4839 </li></ul>
4840
4841 !! end
4842
4843 !! test
4844 1. Lists with start-of-line-transparent tokens before bullets: Comments
4845 !! input
4846 *foo
4847 *<!--cmt-->bar
4848 <!--cmt-->*baz
4849 !! result
4850 <ul><li>foo
4851 </li><li>bar
4852 </li><li>baz
4853 </li></ul>
4854
4855 !! end
4856
4857 !! test
4858 2. Lists with start-of-line-transparent tokens before bullets: Template close
4859 !! input
4860 *foo {{echo|bar
4861 }}*baz
4862 !! result
4863 <ul><li>foo bar
4864 </li><li>baz
4865 </li></ul>
4866
4867 !! end
4868
4869 !! test
4870 Unbalanced closing block tags break a list
4871 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4872 !! options
4873 parsoid
4874 !! input
4875 <div>
4876 *a</div><div>
4877 *b</div>
4878 !! result
4879 <div>
4880 <ul><li>a
4881 </li></ul></div><div>
4882 <ul><li>b
4883 </li></ul></div>
4884 !! end
4885
4886 !! test
4887 Unbalanced closing non-block tags don't break a list
4888 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4889 !! options
4890 parsoid
4891 !! input
4892 <span>
4893 *a</span><span>
4894 *b</span>
4895 !! result
4896 <p><span></span>
4897 </p>
4898 <ul><li>a<span></span>
4899 </li><li>b
4900 </li></ul>
4901 !! end
4902
4903 !! test
4904 Unclosed formatting tags that straddle lists are closed and reopened
4905 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4906 !! options
4907 parsoid
4908 !! input
4909 # <s> a
4910 # b </s>
4911 !! result
4912 <ol><li> <s> a </s>
4913 </li><li> <s> b </s>
4914 </li></ol>
4915 !! end
4916
4917 !!test
4918 List embedded in a non-block tag
4919 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4920 !! options
4921 parsoid
4922 !!input
4923 <small>
4924 * foo
4925 </small>
4926 !!result
4927 <p><small></small></p>
4928 <small>
4929 <ul>
4930 <li> foo</li>
4931 </ul>
4932 </small>
4933 <p><small></small></p>
4934 !!end
4935
4936 !! test
4937 List items are not parsed correctly following a <pre> block (bug 785)
4938 !! input
4939 * <pre>foo</pre>
4940 * <pre>bar</pre>
4941 * zar
4942 !! result
4943 <ul><li> <pre>foo</pre>
4944 </li><li> <pre>bar</pre>
4945 </li><li> zar
4946 </li></ul>
4947
4948 !! end
4949
4950 !! test
4951 List items from template
4952 !! input
4953
4954 {{inner list}}
4955 * item 2
4956
4957 * item 0
4958 {{inner list}}
4959 * item 2
4960
4961 * item 0
4962 * notSOL{{inner list}}
4963 * item 2
4964 !! result
4965 <ul><li> item 1
4966 </li><li> item 2
4967 </li></ul>
4968 <ul><li> item 0
4969 </li><li> item 1
4970 </li><li> item 2
4971 </li></ul>
4972 <ul><li> item 0
4973 </li><li> notSOL
4974 </li><li> item 1
4975 </li><li> item 2
4976 </li></ul>
4977
4978 !! end
4979
4980 !! test
4981 List interrupted by empty line or heading
4982 !! input
4983 * foo
4984
4985 ** bar
4986 == A heading ==
4987 * Another list item
4988 !! result
4989 <ul><li> foo
4990 </li></ul>
4991 <ul><li><ul><li> bar
4992 </li></ul>
4993 </li></ul>
4994 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span></h2>
4995 <ul><li> Another list item
4996 </li></ul>
4997
4998 !!end
4999
5000 !!test
5001 Multiple list tags generated by templates
5002 !!input
5003 {{echo|<li>}}a
5004 {{echo|<li>}}b
5005 {{echo|<li>}}c
5006 !!result
5007 <li>a
5008 <li>b
5009 <li>c</li>
5010 </li>
5011 </li>
5012
5013 !!end
5014
5015 !!test
5016 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5017 !!input
5018 *a
5019 <!--This line will NOT split the list-->
5020 *b
5021 <!--This line will NOT split the list either-->
5022 *c
5023 <!--foo--> <!--This line with more than 1 comment will split the list-->
5024 *d
5025 !!result
5026 <ul><li>a
5027 </li><li>b
5028 </li><li>c
5029 </li></ul>
5030 <ul><li>d
5031 </li></ul>
5032
5033 !!end
5034
5035 ###
5036 ### Magic Words
5037 ###
5038
5039 !! test
5040 Magic Word: {{CURRENTDAY}}
5041 !! input
5042 {{CURRENTDAY}}
5043 !! result
5044 <p>1
5045 </p>
5046 !! end
5047
5048 !! test
5049 Magic Word: {{CURRENTDAY2}}
5050 !! input
5051 {{CURRENTDAY2}}
5052 !! result
5053 <p>01
5054 </p>
5055 !! end
5056
5057 !! test
5058 Magic Word: {{CURRENTDAYNAME}}
5059 !! input
5060 {{CURRENTDAYNAME}}
5061 !! result
5062 <p>Thursday
5063 </p>
5064 !! end
5065
5066 !! test
5067 Magic Word: {{CURRENTDOW}}
5068 !! input
5069 {{CURRENTDOW}}
5070 !! result
5071 <p>4
5072 </p>
5073 !! end
5074
5075 !! test
5076 Magic Word: {{CURRENTMONTH}}
5077 !! input
5078 {{CURRENTMONTH}}
5079 !! result
5080 <p>01
5081 </p>
5082 !! end
5083
5084 !! test
5085 Magic Word: {{CURRENTMONTHABBREV}}
5086 !! input
5087 {{CURRENTMONTHABBREV}}
5088 !! result
5089 <p>Jan
5090 </p>
5091 !! end
5092
5093 !! test
5094 Magic Word: {{CURRENTMONTHNAME}}
5095 !! input
5096 {{CURRENTMONTHNAME}}
5097 !! result
5098 <p>January
5099 </p>
5100 !! end
5101
5102 !! test
5103 Magic Word: {{CURRENTMONTHNAMEGEN}}
5104 !! input
5105 {{CURRENTMONTHNAMEGEN}}
5106 !! result
5107 <p>January
5108 </p>
5109 !! end
5110
5111 !! test
5112 Magic Word: {{CURRENTTIME}}
5113 !! input
5114 {{CURRENTTIME}}
5115 !! result
5116 <p>00:02
5117 </p>
5118 !! end
5119
5120 !! test
5121 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5122 !! input
5123 {{CURRENTWEEK}}
5124 !! result
5125 <p>1
5126 </p>
5127 !! end
5128
5129 !! test
5130 Magic Word: {{CURRENTYEAR}}
5131 !! input
5132 {{CURRENTYEAR}}
5133 !! result
5134 <p>1970
5135 </p>
5136 !! end
5137
5138 !! test
5139 Magic Word: {{FULLPAGENAME}}
5140 !! options
5141 title=[[User:Ævar Arnfjörð Bjarmason]]
5142 !! input
5143 {{FULLPAGENAME}}
5144 !! result
5145 <p>User:Ævar Arnfjörð Bjarmason
5146 </p>
5147 !! end
5148
5149 !! test
5150 Magic Word: {{FULLPAGENAMEE}}
5151 !! options
5152 title=[[User:Ævar Arnfjörð Bjarmason]]
5153 !! input
5154 {{FULLPAGENAMEE}}
5155 !! result
5156 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5157 </p>
5158 !! end
5159
5160 !! test
5161 Magic Word: {{NAMESPACE}}
5162 !! options
5163 title=[[User:Ævar Arnfjörð Bjarmason]]
5164 !! input
5165 {{NAMESPACE}}
5166 !! result
5167 <p>User
5168 </p>
5169 !! end
5170
5171 !! test
5172 Magic Word: {{NAMESPACEE}}
5173 !! options
5174 title=[[User:Ævar Arnfjörð Bjarmason]]
5175 !! input
5176 {{NAMESPACEE}}
5177 !! result
5178 <p>User
5179 </p>
5180 !! end
5181
5182 !! test
5183 Magic Word: {{NAMESPACENUMBER}}
5184 !! options
5185 title=[[User:Ævar Arnfjörð Bjarmason]]
5186 !! input
5187 {{NAMESPACENUMBER}}
5188 !! result
5189 <p>2
5190 </p>
5191 !! end
5192
5193 !! test
5194 Magic Word: {{NUMBEROFFILES}}
5195 !! input
5196 {{NUMBEROFFILES}}
5197 !! result
5198 <p>3
5199 </p>
5200 !! end
5201
5202 !! test
5203 Magic Word: {{PAGENAME}}
5204 !! options
5205 title=[[User:Ævar Arnfjörð Bjarmason]]
5206 !! input
5207 {{PAGENAME}}
5208 !! result
5209 <p>Ævar Arnfjörð Bjarmason
5210 </p>
5211 !! end
5212
5213 !! test
5214 Magic Word: {{PAGENAME}} with metacharacters
5215 !! options
5216 title=[['foo & bar = baz']]
5217 !! input
5218 ''{{PAGENAME}}''
5219 !! result
5220 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5221 </p>
5222 !! end
5223
5224 !! test
5225 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5226 !! options
5227 title=[[*RFC 1234 http://example.com/]]
5228 !! input
5229 {{PAGENAME}}
5230 !! result
5231 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5232 </p>
5233 !! end
5234
5235 !! test
5236 Magic Word: {{PAGENAMEE}}
5237 !! options
5238 title=[[User:Ævar Arnfjörð Bjarmason]]
5239 !! input
5240 {{PAGENAMEE}}
5241 !! result
5242 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5243 </p>
5244 !! end
5245
5246 !! test
5247 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5248 !! options
5249 title=[[*RFC 1234 http://example.com/]]
5250 !! input
5251 {{PAGENAMEE}}
5252 !! result
5253 <p>&#42;RFC_1234_http&#58;//example.com/
5254 </p>
5255 !! end
5256
5257 !! test
5258 Magic Word: {{REVISIONID}}
5259 !! input
5260 {{REVISIONID}}
5261 !! result
5262 <p>1337
5263 </p>
5264 !! end
5265
5266 !! test
5267 Magic Word: {{SCRIPTPATH}}
5268 !! input
5269 {{SCRIPTPATH}}
5270 !! result
5271 <p>/
5272 </p>
5273 !! end
5274
5275 !! test
5276 Magic Word: {{SERVER}}
5277 !! input
5278 {{SERVER}}
5279 !! result
5280 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5281 </p>
5282 !! end
5283
5284 !! test
5285 Magic Word: {{SERVERNAME}}
5286 !! input
5287 {{SERVERNAME}}
5288 !! result
5289 <p>example.org
5290 </p>
5291 !! end
5292
5293 !! test
5294 Magic Word: {{SITENAME}}
5295 !! input
5296 {{SITENAME}}
5297 !! result
5298 <p>MediaWiki
5299 </p>
5300 !! end
5301
5302 !! test
5303 Case-sensitive magic words, when cased differently, should just be template transclusions
5304 !! input
5305 {{CurrentMonth}}
5306 {{currentday}}
5307 {{cURreNTweEK}}
5308 {{currentHour}}
5309 !! result
5310 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
5311 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
5312 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
5313 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
5314 </p>
5315 !! end
5316
5317 !! test
5318 Case-insensitive magic words should still work with weird casing.
5319 !! input
5320 {{sErVeRNaMe}}
5321 {{LCFirst:AOEU}}
5322 {{ucFIRST:aoeu}}
5323 {{SERver}}
5324 !! result
5325 <p>example.org
5326 aOEU
5327 Aoeu
5328 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5329 </p>
5330 !! end
5331
5332 !! test
5333 Namespace 1 {{ns:1}}
5334 !! input
5335 {{ns:1}}
5336 !! result
5337 <p>Talk
5338 </p>
5339 !! end
5340
5341 !! test
5342 Namespace 1 {{ns:01}}
5343 !! input
5344 {{ns:01}}
5345 !! result
5346 <p>Talk
5347 </p>
5348 !! end
5349
5350 !! test
5351 Namespace 0 {{ns:0}} (bug 4783)
5352 !! input
5353 {{ns:0}}
5354 !! result
5355
5356 !! end
5357
5358 !! test
5359 Namespace 0 {{ns:00}} (bug 4783)
5360 !! input
5361 {{ns:00}}
5362 !! result
5363
5364 !! end
5365
5366 !! test
5367 Namespace -1 {{ns:-1}}
5368 !! input
5369 {{ns:-1}}
5370 !! result
5371 <p>Special
5372 </p>
5373 !! end
5374
5375 !! test
5376 Namespace User {{ns:User}}
5377 !! input
5378 {{ns:User}}
5379 !! result
5380 <p>User
5381 </p>
5382 !! end
5383
5384 !! test
5385 Namespace User talk {{ns:User_talk}}
5386 !! input
5387 {{ns:User_talk}}
5388 !! result
5389 <p>User talk
5390 </p>
5391 !! end
5392
5393 !! test
5394 Namespace User talk {{ns:uSeR tAlK}}
5395 !! input
5396 {{ns:uSeR tAlK}}
5397 !! result
5398 <p>User talk
5399 </p>
5400 !! end
5401
5402 !! test
5403 Namespace File {{ns:File}}
5404 !! input
5405 {{ns:File}}
5406 !! result
5407 <p>File
5408 </p>
5409 !! end
5410
5411 !! test
5412 Namespace File {{ns:Image}}
5413 !! input
5414 {{ns:Image}}
5415 !! result
5416 <p>File
5417 </p>
5418 !! end
5419
5420 !! test
5421 Namespace (lang=de) Benutzer {{ns:User}}
5422 !! options
5423 language=de
5424 !! input
5425 {{ns:User}}
5426 !! result
5427 <p>Benutzer
5428 </p>
5429 !! end
5430
5431 !! test
5432 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5433 !! options
5434 language=de
5435 !! input
5436 {{ns:3}}
5437 !! result
5438 <p>Benutzer Diskussion
5439 </p>
5440 !! end
5441
5442
5443 !! test
5444 Urlencode
5445 !! input
5446 {{urlencode:hi world?!}}
5447 {{urlencode:hi world?!|WIKI}}
5448 {{urlencode:hi world?!|PATH}}
5449 {{urlencode:hi world?!|QUERY}}
5450 !! result
5451 <p>hi+world%3F%21
5452 hi_world%3F!
5453 hi%20world%3F%21
5454 hi+world%3F%21
5455 </p>
5456 !! end
5457
5458 ###
5459 ### Magic links
5460 ###
5461 !! test
5462 Magic links: internal link to RFC (bug 479)
5463 !! input
5464 [[RFC 123]]
5465 !! result
5466 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
5467 </p>
5468 !! end
5469
5470 !! test
5471 Magic links: RFC (bug 479)
5472 !! input
5473 RFC 822
5474 !! result
5475 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5476 </p>
5477 !! end
5478
5479 !! test
5480 Magic links: ISBN (bug 1937)
5481 !! input
5482 ISBN 0-306-40615-2
5483 !! result
5484 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5485 </p>
5486 !! end
5487
5488 !! test
5489 Magic links: PMID incorrectly converts space to underscore
5490 !! input
5491 PMID 1234
5492 !! result
5493 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5494 </p>
5495 !! end
5496
5497 ###
5498 ### Templates
5499 ####
5500
5501 !! test
5502 Nonexistent template
5503 !! input
5504 {{thistemplatedoesnotexist}}
5505 !! result
5506 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
5507 </p>
5508 !! end
5509
5510 !! test
5511 Template with invalid target containing tags
5512 !! input
5513 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5514 !! result
5515 <p>{{a<b>b</b>|foo|a=b|a = b}}
5516 </p>
5517 !! end
5518
5519 !! test
5520 Template with invalid target containing unclosed tag
5521 !! input
5522 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5523 !! result
5524 <p>{{a<b>|foo|a=b|a = b}}</b>
5525 </p>
5526 !! end
5527
5528 !! article
5529 Template:test
5530 !! text
5531 This is a test template
5532 !! endarticle
5533
5534 !! test
5535 Simple template
5536 !! input
5537 {{test}}
5538 !! result
5539 <p>This is a test template
5540 </p>
5541 !! end
5542
5543 !! test
5544 Template with explicit namespace
5545 !! input
5546 {{Template:test}}
5547 !! result
5548 <p>This is a test template
5549 </p>
5550 !! end
5551
5552
5553 !! article
5554 Template:paramtest
5555 !! text
5556 This is a test template with parameter {{{param}}}
5557 !! endarticle
5558
5559 !! test
5560 Template parameter
5561 !! input
5562 {{paramtest|param=foo}}
5563 !! result
5564 <p>This is a test template with parameter foo
5565 </p>
5566 !! end
5567
5568 !! article
5569 Template:paramtestnum
5570 !! text
5571 [[{{{1}}}|{{{2}}}]]
5572 !! endarticle
5573
5574 !! test
5575 Template unnamed parameter
5576 !! input
5577 {{paramtestnum|Main Page|the main page}}
5578 !! result
5579 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5580 </p>
5581 !! end
5582
5583 !! article
5584 Template:templatesimple
5585 !! text
5586 (test)
5587 !! endarticle
5588
5589 !! article
5590 Template:templateredirect
5591 !! text
5592 #redirect [[Template:templatesimple]]
5593 !! endarticle
5594
5595 !! article
5596 Template:templateasargtestnum
5597 !! text
5598 {{{{{1}}}}}
5599 !! endarticle
5600
5601 !! article
5602 Template:templateasargtest
5603 !! text
5604 {{template{{{templ}}}}}
5605 !! endarticle
5606
5607 !! article
5608 Template:templateasargtest2
5609 !! text
5610 {{{{{templ}}}}}
5611 !! endarticle
5612
5613 !! test
5614 Template with template name as unnamed argument
5615 !! input
5616 {{templateasargtestnum|templatesimple}}
5617 !! result
5618 <p>(test)
5619 </p>
5620 !! end
5621
5622 !! test
5623 Template with template name as argument
5624 !! input
5625 {{templateasargtest|templ=simple}}
5626 !! result
5627 <p>(test)
5628 </p>
5629 !! end
5630
5631 !! test
5632 Template with template name as argument (2)
5633 !! input
5634 {{templateasargtest2|templ=templatesimple}}
5635 !! result
5636 <p>(test)
5637 </p>
5638 !! end
5639
5640 !! article
5641 Template:templateasargtestdefault
5642 !! text
5643 {{{{{templ|templatesimple}}}}}
5644 !! endarticle
5645
5646 !! article
5647 Template:templa
5648 !! text
5649 '''templ'''
5650 !! endarticle
5651
5652 !! test
5653 Template with default value
5654 !! input
5655 {{templateasargtestdefault}}
5656 !! result
5657 <p>(test)
5658 </p>
5659 !! end
5660
5661 !! test
5662 Template with default value (value set)
5663 !! input
5664 {{templateasargtestdefault|templ=templa}}
5665 !! result
5666 <p><b>templ</b>
5667 </p>
5668 !! end
5669
5670 !! test
5671 Template redirect
5672 !! input
5673 {{templateredirect}}
5674 !! result
5675 <p>(test)
5676 </p>
5677 !! end
5678
5679 !! test
5680 Template with argument in separate line
5681 !! input
5682 {{ templateasargtest |
5683 templ = simple }}
5684 !! result
5685 <p>(test)
5686 </p>
5687 !! end
5688
5689 !! test
5690 Template with complex template as argument
5691 !! input
5692 {{paramtest|
5693 param ={{ templateasargtest |
5694 templ = simple }}}}
5695 !! result
5696 <p>This is a test template with parameter (test)
5697 </p>
5698 !! end
5699
5700 !! test
5701 Template with thumb image (with link in description)
5702 !! input
5703 {{paramtest|
5704 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5705 !! result
5706 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
5707
5708 !! end
5709
5710 !! article
5711 Template:complextemplate
5712 !! text
5713 {{{1}}} {{paramtest|
5714 param ={{{param}}}}}
5715 !! endarticle
5716
5717 !! test
5718 Template with complex arguments
5719 !! input
5720 {{complextemplate|
5721 param ={{ templateasargtest |
5722 templ = simple }}|[[Template:complextemplate|link]]}}
5723 !! result
5724 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5725 </p>
5726 !! end
5727
5728 !! test
5729 BUG 553: link with two variables in a piped link
5730 !! input
5731 {|
5732 |[[{{{1}}}|{{{2}}}]]
5733 |}
5734 !! result
5735 <table>
5736 <tr>
5737 <td>[[{{{1}}}|{{{2}}}]]
5738 </td></tr></table>
5739
5740 !! end
5741
5742 !! test
5743 Magic variable as template parameter
5744 !! input
5745 {{paramtest|param={{SITENAME}}}}
5746 !! result
5747 <p>This is a test template with parameter MediaWiki
5748 </p>
5749 !! end
5750
5751 !! article
5752 Template:linktest
5753 !! text
5754 [[{{{param}}}|link]]
5755 !! endarticle
5756
5757 !! test
5758 Template parameter as link source
5759 !! input
5760 {{linktest|param=Main Page}}
5761 !! result
5762 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5763 </p>
5764 !! end
5765
5766 !!test
5767 Template-generated attribute string (k='v')
5768 !!input
5769 <span {{attr_str|id|v1}}>bar</span>
5770 !!result
5771 <p><span id="v1">bar</span>
5772 </p>
5773 !!end
5774
5775 !!article
5776 Template:paramtest2
5777 !! text
5778 including another template, {{paramtest|param={{{arg}}}}}
5779 !! endarticle
5780
5781 !! test
5782 Template passing argument to another template
5783 !! input
5784 {{paramtest2|arg='hmm'}}
5785 !! result
5786 <p>including another template, This is a test template with parameter 'hmm'
5787 </p>
5788 !! end
5789
5790 !! article
5791 Template:Linktest2
5792 !! text
5793 Main Page
5794 !! endarticle
5795
5796 !! test
5797 Template as link source
5798 !! input
5799 [[{{linktest2}}]]
5800
5801 [[{{linktest2}}|Main Page]]
5802
5803 [[{{linktest2}}]]Page
5804 !! result
5805 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5806 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5807 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5808 </p>
5809 !! end
5810
5811
5812 !! article
5813 Template:loop1
5814 !! text
5815 {{loop2}}
5816 !! endarticle
5817
5818 !! article
5819 Template:loop2
5820 !! text
5821 {{loop1}}
5822 !! endarticle
5823
5824 !! test
5825 Template infinite loop
5826 !! input
5827 {{loop1}}
5828 !! result
5829 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5830 </p>
5831 !! end
5832
5833 !! test
5834 Template from main namespace
5835 !! input
5836 {{:Main Page}}
5837 !! result
5838 <p>blah blah
5839 </p>
5840 !! end
5841
5842 !! article
5843 Template:table
5844 !! text
5845 {|
5846 | 1 || 2
5847 |-
5848 | 3 || 4
5849 |}
5850 !! endarticle
5851
5852 !! test
5853 BUG 529: Template with table, not included at beginning of line
5854 !! input
5855 foo {{table}}
5856 !! result
5857 <p>foo
5858 </p>
5859 <table>
5860 <tr>
5861 <td> 1 </td>
5862 <td> 2
5863 </td></tr>
5864 <tr>
5865 <td> 3 </td>
5866 <td> 4
5867 </td></tr></table>
5868
5869 !! end
5870
5871 !! test
5872 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5873 !! input
5874 foo
5875 {{table}}
5876 !! result
5877 <p>foo
5878 </p>
5879 <table>
5880 <tr>
5881 <td> 1 </td>
5882 <td> 2
5883 </td></tr>
5884 <tr>
5885 <td> 3 </td>
5886 <td> 4
5887 </td></tr></table>
5888
5889 !! end
5890
5891 !! test
5892 BUG 41: Template parameters shown as broken links
5893 !! input
5894 {{{parameter}}}
5895 !! result
5896 <p>{{{parameter}}}
5897 </p>
5898 !! end
5899
5900 !! test
5901 Template with targets containing wikilinks
5902 !! input
5903 {{[[foo]]}}
5904
5905 {{[[{{echo|foo}}]]}}
5906
5907 {{{{echo|[[foo}}]]}}
5908 !! result
5909 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5910 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5911 </p><p>{{[[foo}}]]
5912 </p>
5913 !! end
5914
5915 !! article
5916 Template:MSGNW test
5917 !! text
5918 ''None'' of '''this''' should be
5919 * interpreted
5920 but rather passed unmodified
5921 {{test}}
5922 !! endarticle
5923
5924 # hmm, fix this or just deprecate msgnw and document its behavior?
5925 !! test
5926 msgnw keyword
5927 !! options
5928 disabled
5929 !! input
5930 {{msgnw:MSGNW test}}
5931 !! result
5932 <p>''None'' of '''this''' should be
5933 * interpreted
5934 but rather passed unmodified
5935 {{test}}
5936 </p>
5937 !! end
5938
5939 !! test
5940 int keyword
5941 !! input
5942 {{int:youhavenewmessages|lots of money|not!}}
5943 !! result
5944 <p>You have lots of money (not!).
5945 </p>
5946 !! end
5947
5948 !! article
5949 Template:Includes
5950 !! text
5951 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5952 !! endarticle
5953
5954 !! test
5955 <includeonly> and <noinclude> being included
5956 !! input
5957 {{Includes}}
5958 !! result
5959 <p>Foobar
5960 </p>
5961 !! end
5962
5963 !! article
5964 Template:Includes2
5965 !! text
5966 <onlyinclude>Foo</onlyinclude>bar
5967 !! endarticle
5968
5969 !! test
5970 <onlyinclude> being included
5971 !! input
5972 {{Includes2}}
5973 !! result
5974 <p>Foo
5975 </p>
5976 !! end
5977
5978
5979 !! article
5980 Template:Includes3
5981 !! text
5982 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5983 !! endarticle
5984
5985 !! test
5986 <onlyinclude> and <includeonly> being included
5987 !! input
5988 {{Includes3}}
5989 !! result
5990 <p>Foo
5991 </p>
5992 !! end
5993
5994 !! test
5995 <includeonly> and <noinclude> on a page
5996 !! input
5997 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5998 !! result
5999 <p>Foozar
6000 </p>
6001 !! end
6002
6003 !! test
6004 Un-closed <noinclude>
6005 !! input
6006 <noinclude>
6007 !! result
6008 !! end
6009
6010 !! test
6011 <onlyinclude> on a page
6012 !! input
6013 <onlyinclude>Foo</onlyinclude>bar
6014 !! result
6015 <p>Foobar
6016 </p>
6017 !! end
6018
6019 !! test
6020 Un-closed <onlyinclude>
6021 !! input
6022 <onlyinclude>
6023 !! result
6024 !! end
6025
6026 !!test
6027 Self-closed noinclude, includeonly, onlyinclude tags
6028 !!input
6029 <noinclude />
6030 <includeonly />
6031 <onlyinclude />
6032 !!result
6033 <p><br />
6034 </p>
6035 !!end
6036
6037 !!test
6038 Unbalanced includeonly and noinclude tags
6039 !!input
6040 {|
6041 |a</noinclude>
6042 |b</noinclude></noinclude>
6043 |c</noinclude></includeonly>
6044 |d</includeonly></includeonly>
6045 |}
6046 !!result
6047 <table>
6048 <tr>
6049 <td>a
6050 </td>
6051 <td>b
6052 </td>
6053 <td>c&lt;/includeonly&gt;
6054 </td>
6055 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6056 </td></tr></table>
6057
6058 !!end
6059
6060 !! article
6061 Template:Includeonly section
6062 !! text
6063 <includeonly>
6064 ==Includeonly section==
6065 </includeonly>
6066 ==Section T-1==
6067 !!endarticle
6068
6069 !! test
6070 Bug 6563: Edit link generation for section shown by <includeonly>
6071 !! input
6072 {{includeonly section}}
6073 !! result
6074 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span></h2>
6075 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span></h2>
6076
6077 !! end
6078
6079 # Uses same input as the contents of [[Template:Includeonly section]]
6080 !! test
6081 Bug 6563: Section extraction for section shown by <includeonly>
6082 !! options
6083 section=T-2
6084 !! input
6085 <includeonly>
6086 ==Includeonly section==
6087 </includeonly>
6088 ==Section T-2==
6089 !! result
6090 ==Section T-2==
6091 !! end
6092
6093 !! test
6094 Bug 6563: Edit link generation for section suppressed by <includeonly>
6095 !! input
6096 <includeonly>
6097 ==Includeonly section==
6098 </includeonly>
6099 ==Section 1==
6100 !! result
6101 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
6102
6103 !! end
6104
6105 !! test
6106 Bug 6563: Section extraction for section suppressed by <includeonly>
6107 !! options
6108 section=1
6109 !! input
6110 <includeonly>
6111 ==Includeonly section==
6112 </includeonly>
6113 ==Section 1==
6114 !! result
6115 ==Section 1==
6116 !! end
6117
6118 !! test
6119 Un-closed <includeonly>
6120 !! input
6121 <includeonly>
6122 !! result
6123 !! end
6124
6125 ###
6126 ### <includeonly> and <noinclude> in attributes
6127 ###
6128 !!test
6129 0. includeonly around the entire attribute
6130 !!input
6131 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6132 !!result
6133 <p><span id="v2">bar</span>
6134 </p>
6135 !!end
6136
6137 !!test
6138 1. includeonly in html attr key
6139 !!input
6140 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6141 !!result
6142 <p><span id="foo">bar</span>
6143 </p>
6144 !!end
6145
6146 !!test
6147 2. includeonly in html attr value
6148 !!input
6149 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6150 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6151 !!result
6152 <p><span id="v1">bar</span>
6153 <span id="v1">bar</span>
6154 </p>
6155 !!end
6156
6157 !!test
6158 3. includeonly in part of an attr value
6159 !!input
6160 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6161 !!result
6162 <p><span style="color:red;">bar</span>
6163 </p>
6164 !!end
6165
6166 ###
6167 ### Testing parsing of templates where a template arg
6168 ### has the same name as the template itself.
6169 ###
6170
6171 !! article
6172 Template:quote
6173 !! text
6174 {{{quote|{{{1}}}}}}
6175 !! endarticle
6176
6177 !!test
6178 Templates: Template Name/Arg clash: 1. Use of positional param
6179 !!input
6180 {{quote|foo}}
6181 !!result
6182 <p>foo
6183 </p>
6184 !!end
6185
6186 !!test
6187 Templates: Template Name/Arg clash: 2. Use of named param
6188 !!input
6189 {{quote|quote=foo}}
6190 !!result
6191 <p>foo
6192 </p>
6193 !!end
6194
6195 !!test
6196 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6197 !!input
6198 {{quote|quote}}
6199 !!result
6200 <p>quote
6201 </p>
6202 !!end
6203
6204 ###
6205 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6206 ###
6207
6208 !!test
6209 Templates: 1. Simple use
6210 !!input
6211 {{echo|Foo}}
6212 !!result
6213 <p>Foo
6214 </p>
6215 !!end
6216
6217 !!test
6218 Templates: 2. Inside a block tag
6219 !!input
6220 <div>{{echo|Foo}}</div>
6221 !!result
6222 <div>Foo</div>
6223
6224 !!end
6225
6226 !!test
6227 Templates: P-wrapping: 1a. Templates on consecutive lines
6228 !!input
6229 {{echo|Foo}}
6230 {{echo|bar}}
6231 !!result
6232 <p>Foo
6233 bar
6234 </p>
6235 !!end
6236
6237 !!test
6238 Templates: P-wrapping: 1b. Templates on consecutive lines
6239 !!input
6240 Foo
6241
6242 {{echo|bar}}
6243 {{echo|baz}}
6244 !!result
6245 <p>Foo
6246 </p><p>bar
6247 baz
6248 </p>
6249 !!end
6250
6251 !!test
6252 Templates: P-wrapping: 1c. Templates on consecutive lines
6253 !!input
6254 {{echo|Foo}}
6255 {{echo|bar}} <div>baz</div>
6256 !!result
6257 <p>Foo
6258 </p>
6259 bar <div>baz</div>
6260
6261 !!end
6262
6263 !!test
6264 Templates: P-wrapping: 1d. Template preceded by comment-only line
6265 !!options
6266 parsoid=wt2html,wt2wt
6267 !!input
6268 <!-- foo -->
6269 {{echo|Bar}}
6270 !!result
6271 <!-- foo -->
6272 <p typeof="mw:Object/Template">Bar
6273 </p>
6274 !!end
6275
6276 !!test
6277 Templates: Inline Text: 1. Multiple tmeplate uses
6278 !!input
6279 {{echo|Foo}}bar{{echo|baz}}
6280 !!result
6281 <p>Foobarbaz
6282 </p>
6283 !!end
6284
6285 !!test
6286 Templates: Inline Text: 2. Back-to-back template uses
6287 !!input
6288 {{echo|Foo}}{{echo|bar}}
6289 !!result
6290 <p>Foobar
6291 </p>
6292 !!end
6293
6294 !!test
6295 Templates: Block Tags: 1. Multiple template uses
6296 !!input
6297 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6298 !!result
6299 <div>Foo</div><div>bar</div><div>baz</div>
6300
6301 !!end
6302
6303 !!test
6304 Templates: Block Tags: 2. Back-to-back template uses
6305 !!input
6306 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6307 !!result
6308 <div>Foo</div><div>bar</div>
6309
6310 !!end
6311
6312 !!test
6313 Templates: Links: 1. Simple example
6314 !!input
6315 {{echo|[[Foo|bar]]}}
6316 !!result
6317 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6318 </p>
6319 !!end
6320
6321 !!test
6322 Templates: Links: 2. Generation of link href
6323 !!input
6324 [[{{echo|Foo}}|bar]]
6325 !!result
6326 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6327 </p>
6328 !!end
6329
6330 !!test
6331 Templates: Links: 3. Generation of part of a link href
6332 !!input
6333 [[Fo{{echo|o}}|bar]]
6334
6335 [[Foo{{echo|bar}}]]
6336
6337 [[Foo{{echo|bar}}baz]]
6338
6339 [[Foo{{echo|bar}}|bar]]
6340
6341 [[:Foo{{echo|bar}}]]
6342
6343 [[:Foo{{echo|bar}}|bar]]
6344 !!result
6345 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6346 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6347 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6348 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6349 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6350 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6351 </p>
6352 !!end
6353
6354 !!test
6355 Templates: Links: 4. Multiple templates generating link href
6356 !!input
6357 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6358 !!result
6359 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6360 </p>
6361 !!end
6362
6363 !!test
6364 Templates: Links: 5. Generation of link text
6365 !!input
6366 [[Foo|{{echo|bar}}]]
6367 !!result
6368 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6369 </p>
6370 !!end
6371
6372 !!test
6373 Templates: Links: 5. Nested templates (only outermost template should be marked)
6374 !!input
6375 {{echo|[[{{echo|Foo}}|bar]]}}
6376 !!result
6377 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6378 </p>
6379 !!end
6380
6381 !!test
6382 Templates: HTML Tag: 1. Generation of HTML attr. key
6383 !!input
6384 <div {{echo|style}}="color:red;">foo</div>
6385 !!result
6386 <div style="color:red;">foo</div>
6387
6388 !!end
6389
6390 !!test
6391 Templates: HTML Tag: 2. Generation of HTML attr. value
6392 !!input
6393 <div style={{echo|'color:red;'}}>foo</div>
6394 !!result
6395 <div style="color:red;">foo</div>
6396
6397 !!end
6398
6399 !!test
6400 Templates: HTML Tag: 3. Generation of HTML attr key and value
6401 !!input
6402 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6403 !!result
6404 <div style="color:red;">foo</div>
6405
6406 !!end
6407
6408 !!test
6409 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6410 !!input
6411 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6412 !!result
6413 <div title="This is a long title with just one piece templated">foo</div>
6414
6415 !!end
6416
6417 !!test
6418 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6419 !!input
6420 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6421 !!result
6422 <div title="This is a long title with just one piece templated">foo</div>
6423
6424 !!end
6425
6426 !!test
6427 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6428 !!input
6429 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6430 !!result
6431 <div title="This is a long title with just one piece templated">foo</div>
6432
6433 !!end
6434
6435 !!test
6436 Templates: HTML Tag: 7. Generation of partial attribute key string
6437 !!input
6438 <div st{{echo|yle}}="color:red;">foo</div>
6439 !!result
6440 <div style="color:red;">foo</div>
6441
6442 !!end
6443
6444 !!test
6445 Templates: HTML Tables: 1. Generating start of a HTML table
6446 !!input
6447 {{echo|<table><tr><td>foo</td>}}</tr></table>
6448 !!result
6449 <table><tr><td>foo</td></tr></table>
6450
6451 !!end
6452
6453 !!test
6454 Templates: HTML Tables: 2a. Generating middle of a HTML table
6455 !!input
6456 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6457 !!result
6458 <table><tr><td>foo</td></tr></table>
6459
6460 !!end
6461
6462 !!test
6463 Templates: HTML Tables: 2b. Generating middle of a HTML table
6464 !!input
6465 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6466 !!result
6467 <table><tr><td>foo</td></tr></table>
6468
6469 !!end
6470
6471 !!test
6472 Templates: HTML Tables: 3. Generating end of a HTML table
6473 !!input
6474 <table><tr>{{echo|<td>foo</td></tr></table>}}
6475 !!result
6476 <table><tr><td>foo</td></tr></table>
6477
6478 !!end
6479
6480 !!test
6481 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6482 !!input
6483 {{echo|<table>}}<tr><td>foo</td></tr></table>
6484 !!result
6485 <table><tr><td>foo</td></tr></table>
6486
6487 !!end
6488
6489 !!test
6490 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6491 !!input
6492 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6493 !!result
6494 <table><tr><td>foo</td></tr></table>
6495
6496 !!end
6497
6498 !!test
6499 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6500 !!input
6501 <table><tr>{{echo|<td>}}foo</td></tr></table>
6502 !!result
6503 <table><tr><td>foo</td></tr></table>
6504
6505 !!end
6506
6507 !!test
6508 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6509 !!input
6510 <table><tr><td>foo{{echo|</td>}}</tr></table>
6511 !!result
6512 <table><tr><td>foo</td></tr></table>
6513
6514 !!end
6515
6516 !!test
6517 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6518 !!input
6519 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6520 !!result
6521 <table><tr><td>foo</td></tr></table>
6522
6523 !!end
6524
6525 !!test
6526 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6527 !!input
6528 <table><tr><td>foo</td></tr>{{echo|</table>}}
6529 !!result
6530 <table><tr><td>foo</td></tr></table>
6531
6532 !!end
6533
6534 !!test
6535 Templates: Wiki Tables: 1a. Fostering of entire template content
6536 !!input
6537 {|
6538 {{echo|a}}
6539 |}
6540 !!result
6541 <table>
6542 a
6543 <tr><td></td></tr></table>
6544
6545 !!end
6546
6547 !!test
6548 Templates: Wiki Tables: 1b. Fostering of entire template content
6549 !!input
6550 {|
6551 {{echo|<div>}}
6552 foo
6553 {{echo|</div>}}
6554 |}
6555 !!result
6556 <table>
6557 <div>
6558 <p>foo
6559 </p>
6560 </div>
6561 <tr><td></td></tr></table>
6562
6563 !!end
6564
6565 !!test
6566 Templates: Wiki Tables: 2. Fostering of partial template content
6567 !!input
6568 {|
6569 {{echo|a
6570 <div>b</div>}}
6571 |}
6572 !!result
6573 <table>
6574 a
6575 <div>b</div>
6576 <tr><td></td></tr></table>
6577
6578 !!end
6579
6580 !!test
6581 Templates: Wiki Tables: 3. td-content via multiple templates
6582 !!input
6583 {|
6584 {{echo|{{pipe}}a}}{{echo|b}}
6585 |}
6586 !!result
6587 <table>
6588 <tr>
6589 <td>ab
6590 </td></tr></table>
6591
6592 !!end
6593
6594 !!test
6595 Templates: Wiki Tables: 4. Templated tags, no content
6596 !!input
6597 {{tbl-start}}
6598 {{tbl-end}}
6599 !!result
6600 <table>
6601 <tr><td></td></tr></table>
6602
6603 !!end
6604
6605 !!test
6606 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6607 !!input
6608 {{tbl-start}}
6609 |foo
6610 {{tbl-end}}
6611 !!result
6612 <table>
6613 <tr>
6614 <td>foo
6615 </td></tr></table>
6616
6617 !!end
6618
6619 !!test
6620 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6621 !!input
6622 {{tbl-start}}
6623 {{!}}foo
6624 {{tbl-end}}
6625 !!result
6626 <table>
6627 <tr>
6628 <td>foo
6629 </td></tr></table>
6630
6631 !!end
6632
6633 !!test
6634 Templates: Lists: Multi-line list-items via templates
6635 !!input
6636 *{{echo|a {{nonexistent|
6637 unused}}}}
6638 *{{echo|b {{nonexistent|
6639 unused}}}}
6640 !!result
6641 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6642 </li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6643 </li></ul>
6644
6645 !!end
6646
6647 !!test
6648 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6649 !!input
6650 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6651 !!result
6652 <p><i>ab</i>c<i>d</i>e
6653 </p>
6654 !!end
6655
6656 !!test
6657 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6658 (PHP parser generates misnested html)
6659 !! options
6660 parsoid=wt2html,wt2wt
6661 !!input
6662 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6663 !!result
6664 <p><span typeof="mw:Object/Template"><i>a</i></span><i typeof="mw:Object/Template"><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6665 !!end
6666
6667 !!test
6668 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6669 (PHP parser generates misnested html)
6670 !! options
6671 parsoid=wt2html,wt2wt
6672 !!input
6673 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6674 !!result
6675 <div typeof="mw:Object/Template"><i>a</i></div>
6676 <div typeof="mw:Object/Template"><i>b</i>c<i>d</i></div>
6677 <div typeof="mw:Object/Template">e</div>
6678 !!end
6679
6680 !!test
6681 Templates: Ugly nesting: 4. Divs opened/closed across templates
6682 !!input
6683 a<div>b{{echo|c</div>d}}e
6684 !!result
6685 a<div>bc</div>de
6686
6687 !!end
6688
6689 !!test
6690 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6691 (Parsoid-centric)
6692 !! options
6693 parsoid
6694 !!input
6695 {|
6696 |{{echo|foo</table>}}
6697 |bar
6698 |}
6699 !!result
6700 <table typeof="mw:Object/Template">
6701 <tbody>
6702 <tr>
6703 <td>foo</td></tr></tbody></table><span>bar</span>
6704 !!end
6705
6706 !!test
6707 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6708 (Parsoid-centric)
6709 !! options
6710 parsoid
6711 !!input
6712 <table>
6713 <tr>
6714 <td>
6715 <table>
6716 <tr>
6717 <td>1. {{echo|foo </table>}}</td>
6718 <td> bar </td>
6719 <td>2. {{echo|baz </table>}}</td>
6720 </tr>
6721 <tr>
6722 <td>abc</td>
6723 </tr>
6724 </table>
6725 </td>
6726 </tr>
6727 <tr>
6728 <td>xyz</td>
6729 </tr>
6730 </table>
6731 !!result
6732 <table about="#mwt1" typeof="mw:Object/Template">
6733 <tbody><tr >
6734 <td >
6735 <table >
6736 <tbody><tr >
6737 <td >1. foo </td></tr></tbody></table></td>
6738 <td > bar </td>
6739 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6740 </span><span about="#mwt1">
6741
6742 abc</span><span about="#mwt1">
6743 </span><span about="#mwt1">
6744 </span><span about="#mwt1">
6745 </span><span about="#mwt1">
6746 </span><span about="#mwt1">
6747
6748 xyz</span><span about="#mwt1">
6749 </span><span about="#mwt1">
6750 </span>
6751 !!end
6752
6753 !! test
6754 Templates: Ugly templates: 3. newline-only template parameter
6755 !! input
6756 foo {{echo|
6757 }}
6758 !! result
6759 <p>foo
6760 </p>
6761 !! end
6762
6763 # This looks like a bug: a single newline triggers p/br for some reason.
6764 !! test
6765 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6766 !! input
6767 {{echo|
6768 }}
6769 !! result
6770 <p><br />
6771 </p>
6772 !! end
6773
6774
6775 !!test
6776 Parser Functions: 1. Simple example
6777 !!input
6778 {{uc:foo}}
6779 !!result
6780 <p>FOO
6781 </p>
6782 !!end
6783
6784 !!test
6785 Parser Functions: 2. Nested use (only outermost should be marked up)
6786 !!input
6787 {{uc:{{lc:FOO}}}}
6788 !!result
6789 <p>FOO
6790 </p>
6791 !!end
6792
6793 ###
6794 ### Pre-save transform tests
6795 ###
6796 !! test
6797 pre-save transform: subst:
6798 !! options
6799 PST
6800 !! input
6801 {{subst:test}}
6802 !! result
6803 This is a test template
6804 !! end
6805
6806 !! test
6807 pre-save transform: normal template
6808 !! options
6809 PST
6810 !! input
6811 {{test}}
6812 !! result
6813 {{test}}
6814 !! end
6815
6816 !! test
6817 pre-save transform: nonexistent template
6818 !! options
6819 PST
6820 !! input
6821 {{thistemplatedoesnotexist}}
6822 !! result
6823 {{thistemplatedoesnotexist}}
6824 !! end
6825
6826
6827 !! test
6828 pre-save transform: subst magic variables
6829 !! options
6830 PST
6831 !! input
6832 {{subst:SITENAME}}
6833 !! result
6834 MediaWiki
6835 !! end
6836
6837 # This is bug 89, which I fixed. -- wtm
6838 !! test
6839 pre-save transform: subst: templates with parameters
6840 !! options
6841 pst
6842 !! input
6843 {{subst:paramtest|param="something else"}}
6844 !! result
6845 This is a test template with parameter "something else"
6846 !! end
6847
6848 !! article
6849 Template:nowikitest
6850 !! text
6851 <nowiki>'''not wiki'''</nowiki>
6852 !! endarticle
6853
6854 !! test
6855 pre-save transform: nowiki in subst (bug 1188)
6856 !! options
6857 pst
6858 !! input
6859 {{subst:nowikitest}}
6860 !! result
6861 <nowiki>'''not wiki'''</nowiki>
6862 !! end
6863
6864
6865 !! article
6866 Template:commenttest
6867 !! text
6868 This template has <!-- a comment --> in it.
6869 !! endarticle
6870
6871 !! test
6872 pre-save transform: comment in subst (bug 1936)
6873 !! options
6874 pst
6875 !! input
6876 {{subst:commenttest}}
6877 !! result
6878 This template has <!-- a comment --> in it.
6879 !! end
6880
6881 !! test
6882 pre-save transform: unclosed tag
6883 !! options
6884 pst noxml
6885 !! input
6886 <nowiki>'''not wiki'''
6887 !! result
6888 <nowiki>'''not wiki'''
6889 !! end
6890
6891 !! test
6892 pre-save transform: mixed tag case
6893 !! options
6894 pst noxml
6895 !! input
6896 <NOwiki>'''not wiki'''</noWIKI>
6897 !! result
6898 <NOwiki>'''not wiki'''</noWIKI>
6899 !! end
6900
6901 !! test
6902 pre-save transform: unclosed comment in <nowiki>
6903 !! options
6904 pst noxml
6905 !! input
6906 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6907 !! result
6908 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6909 !!end
6910
6911 # Leading @ in this template definition works around a limitation
6912 # in parsoid's parserTests which otherwise strips the <span> from the
6913 # result (confusing it for a template wrapper)
6914 !! article
6915 Template:dangerous
6916 !!text
6917 @<span onmouseover="alert('crap')">Oh no</span>
6918 !!endarticle
6919
6920 !!test
6921 (confirming safety of fix for subst bug 1936)
6922 !! input
6923 {{Template:dangerous}}
6924 !! result
6925 <p>@<span>Oh no</span>
6926 </p>
6927 !! end
6928
6929 !! test
6930 pre-save transform: comment containing gallery (bug 5024)
6931 !! options
6932 pst
6933 !! input
6934 <!-- <gallery>data</gallery> -->
6935 !!result
6936 <!-- <gallery>data</gallery> -->
6937 !!end
6938
6939 !! test
6940 pre-save transform: comment containing extension
6941 !! options
6942 pst
6943 !! input
6944 <!-- <tag>data</tag> -->
6945 !!result
6946 <!-- <tag>data</tag> -->
6947 !!end
6948
6949 !! test
6950 pre-save transform: comment containing nowiki
6951 !! options
6952 pst
6953 !! input
6954 <!-- <nowiki>data</nowiki> -->
6955 !!result
6956 <!-- <nowiki>data</nowiki> -->
6957 !!end
6958
6959 !! test
6960 pre-save transform: <noinclude> in subst (bug 3298)
6961 !! options
6962 pst
6963 !! input
6964 {{subst:Includes}}
6965 !! result
6966 Foobar
6967 !! end
6968
6969 !! test
6970 pre-save transform: <onlyinclude> in subst (bug 3298)
6971 !! options
6972 pst
6973 !! input
6974 {{subst:Includes2}}
6975 !! result
6976 Foo
6977 !! end
6978
6979 !! article
6980 Template:SubstTest
6981 !!text
6982 {{<includeonly>subst:</includeonly>Includes}}
6983 !! endarticle
6984
6985 !! article
6986 Template:SafeSubstTest
6987 !! text
6988 {{<includeonly>safesubst:</includeonly>Includes}}
6989 !! endarticle
6990
6991 !! test
6992 bug 22297: safesubst: works during PST
6993 !! options
6994 pst
6995 !! input
6996 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6997 !! result
6998 FoobarFoobar
6999 !! end
7000
7001 !! test
7002 bug 22297: safesubst: works during normal parse
7003 !! input
7004 {{SafeSubstTest}}
7005 !! result
7006 <p>Foobar
7007 </p>
7008 !! end
7009
7010 !! test:
7011 subst: does not work during normal parse
7012 !! input
7013 {{SubstTest}}
7014 !! result
7015 <p>{{subst:Includes}}
7016 </p>
7017 !! end
7018
7019 !! test
7020 pre-save transform: context links ("pipe trick")
7021 !! options
7022 pst
7023 !! input
7024 [[Article (context)|]]
7025 [[Bar:Article|]]
7026 [[:Bar:Article|]]
7027 [[Bar:Article (context)|]]
7028 [[:Bar:Article (context)|]]
7029 [[|Article]]
7030 [[|Article (context)]]
7031 [[Bar:X (Y) Z|]]
7032 [[:Bar:X (Y) Z|]]
7033 !! result
7034 [[Article (context)|Article]]
7035 [[Bar:Article|Article]]
7036 [[:Bar:Article|Article]]
7037 [[Bar:Article (context)|Article]]
7038 [[:Bar:Article (context)|Article]]
7039 [[Article]]
7040 [[Article (context)]]
7041 [[Bar:X (Y) Z|X (Y) Z]]
7042 [[:Bar:X (Y) Z|X (Y) Z]]
7043 !! end
7044
7045 !! test
7046 pre-save transform: context links ("pipe trick") with interwiki prefix
7047 !! options
7048 pst
7049 !! input
7050 [[interwiki:Article|]]
7051 [[:interwiki:Article|]]
7052 [[interwiki:Bar:Article|]]
7053 [[:interwiki:Bar:Article|]]
7054 !! result
7055 [[interwiki:Article|Article]]
7056 [[:interwiki:Article|Article]]
7057 [[interwiki:Bar:Article|Bar:Article]]
7058 [[:interwiki:Bar:Article|Bar:Article]]
7059 !! end
7060
7061 !! test
7062 pre-save transform: context links ("pipe trick") with parens in title
7063 !! options
7064 pst title=[[Somearticle (context)]]
7065 !! input
7066 [[|Article]]
7067 !! result
7068 [[Article (context)|Article]]
7069 !! end
7070
7071 !! test
7072 pre-save transform: context links ("pipe trick") with comma in title
7073 !! options
7074 pst title=[[Someplace, Somewhere]]
7075 !! input
7076 [[|Otherplace]]
7077 [[Otherplace, Elsewhere|]]
7078 [[Otherplace, Elsewhere, Anywhere|]]
7079 !! result
7080 [[Otherplace, Somewhere|Otherplace]]
7081 [[Otherplace, Elsewhere|Otherplace]]
7082 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7083 !! end
7084
7085 !! test
7086 pre-save transform: context links ("pipe trick") with parens and comma
7087 !! options
7088 pst title=[[Someplace (IGNORED), Somewhere]]
7089 !! input
7090 [[|Otherplace]]
7091 [[Otherplace (place), Elsewhere|]]
7092 !! result
7093 [[Otherplace, Somewhere|Otherplace]]
7094 [[Otherplace (place), Elsewhere|Otherplace]]
7095 !! end
7096
7097 !! test
7098 pre-save transform: context links ("pipe trick") with comma and parens
7099 !! options
7100 pst title=[[Who, me? (context)]]
7101 !! input
7102 [[|Yes, you.]]
7103 [[Me, Myself, and I (1937 song)|]]
7104 !! result
7105 [[Yes, you. (context)|Yes, you.]]
7106 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7107 !! end
7108
7109 !! test
7110 pre-save transform: context links ("pipe trick") with namespace
7111 !! options
7112 pst title=[[Ns:Somearticle]]
7113 !! input
7114 [[|Article]]
7115 !! result
7116 [[Ns:Article|Article]]
7117 !! end
7118
7119 !! test
7120 pre-save transform: context links ("pipe trick") with namespace and parens
7121 !! options
7122 pst title=[[Ns:Somearticle (context)]]
7123 !! input
7124 [[|Article]]
7125 !! result
7126 [[Ns:Article (context)|Article]]
7127 !! end
7128
7129 !! test
7130 pre-save transform: context links ("pipe trick") with namespace and comma
7131 !! options
7132 pst title=[[Ns:Somearticle, Context, Whatever]]
7133 !! input
7134 [[|Article]]
7135 !! result
7136 [[Ns:Article, Context, Whatever|Article]]
7137 !! end
7138
7139 !! test
7140 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7141 !! options
7142 pst title=[[Ns:Somearticle, Context (context)]]
7143 !! input
7144 [[|Article]]
7145 !! result
7146 [[Ns:Article (context)|Article]]
7147 !! end
7148
7149 !! test
7150 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7151 !! options
7152 pst title=[[Ns:Somearticle (IGNORED), Context]]
7153 !! input
7154 [[|Article]]
7155 !! result
7156 [[Ns:Article, Context|Article]]
7157 !! end
7158
7159 !! test
7160 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7161 !! options
7162 pst
7163 !! input
7164 [[Article(context)|]]
7165 [[Bar:Article(context)|]]
7166 [[:Bar:Article(context)|]]
7167 [[|Article(context)]]
7168 [[Bar:X(Y)Z|]]
7169 [[:Bar:X(Y)Z|]]
7170 !! result
7171 [[Article(context)|Article]]
7172 [[Bar:Article(context)|Article]]
7173 [[:Bar:Article(context)|Article]]
7174 [[Article(context)]]
7175 [[Bar:X(Y)Z|X(Y)Z]]
7176 [[:Bar:X(Y)Z|X(Y)Z]]
7177 !! end
7178
7179 !! test
7180 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7181 !! options
7182 pst
7183 !! input
7184 [[Article (context)|]]
7185 [[Bar:Article (context)|]]
7186 [[:Bar:Article (context)|]]
7187 [[|Article (context)]]
7188 [[Bar:X (Y) Z|]]
7189 [[:Bar:X (Y) Z|]]
7190 !! result
7191 [[Article (context)|Article]]
7192 [[Bar:Article (context)|Article]]
7193 [[:Bar:Article (context)|Article]]
7194 [[Article (context)]]
7195 [[Bar:X (Y) Z|X (Y) Z]]
7196 [[:Bar:X (Y) Z|X (Y) Z]]
7197 !! end
7198
7199 !! test
7200 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7201 !! options
7202 pst
7203 !! input
7204 [[Article(context)|]]
7205 [[Bar:Article(context)|]]
7206 [[:Bar:Article(context)|]]
7207 [[|Article(context)]]
7208 [[Bar:X(Y)Z|]]
7209 [[:Bar:X(Y)Z|]]
7210 !! result
7211 [[Article(context)|Article]]
7212 [[Bar:Article(context)|Article]]
7213 [[:Bar:Article(context)|Article]]
7214 [[Article(context)]]
7215 [[Bar:X(Y)Z|X(Y)Z]]
7216 [[:Bar:X(Y)Z|X(Y)Z]]
7217 !! end
7218
7219 !! test
7220 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7221 !! options
7222 pst
7223 !! input
7224 [[Article (context), context|]]
7225 [[Article (context),context|]]
7226 [[Bar:Article (context), context|]]
7227 [[Bar:Article (context),context|]]
7228 [[:Bar:Article (context), context|]]
7229 [[:Bar:Article (context),context|]]
7230 !! result
7231 [[Article (context), context|Article]]
7232 [[Article (context),context|Article]]
7233 [[Bar:Article (context), context|Article]]
7234 [[Bar:Article (context),context|Article]]
7235 [[:Bar:Article (context), context|Article]]
7236 [[:Bar:Article (context),context|Article]]
7237 !! end
7238
7239 !! test
7240 pre-save transform: trim trailing empty lines
7241 !! options
7242 pst
7243 !! input
7244 Empty lines are trimmed
7245
7246
7247
7248
7249 !! result
7250 Empty lines are trimmed
7251 !! end
7252
7253 !! test
7254 pre-save transform: Signature expansion
7255 !! options
7256 pst
7257 !! input
7258 * ~~~
7259 * <noinclude>~~~</noinclude>
7260 * <includeonly>~~~</includeonly>
7261 * <onlyinclude>~~~</onlyinclude>
7262 !! result
7263 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7264 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7265 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7266 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7267 !! end
7268
7269
7270 !! test
7271 pre-save transform: Signature expansion in nowiki tags (bug 93)
7272 !! options
7273 pst disabled
7274 !! input
7275 Shall not expand:
7276
7277 <nowiki>~~~~</nowiki>
7278
7279 <includeonly><nowiki>~~~~</nowiki></includeonly>
7280
7281 <noinclude><nowiki>~~~~</nowiki></noinclude>
7282
7283 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7284
7285 {{subst:Foo}} shall be converted to FOO
7286
7287 As well as inside noinclude/onlyinclude
7288 <noinclude>{{subst:Foo}}</noinclude>
7289 <onlyinclude>{{subst:Foo}}</onlyinclude>
7290
7291 But not inside includeonly
7292 <includeonly>{{subst:Foo}}</includeonly>
7293 !! result
7294 Shall not expand:
7295
7296 <nowiki>~~~~</nowiki>
7297
7298 <includeonly><nowiki>~~~~</nowiki></includeonly>
7299
7300 <noinclude><nowiki>~~~~</nowiki></noinclude>
7301
7302 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7303
7304 FOO shall be converted to FOO
7305
7306 As well as inside noinclude/onlyinclude
7307 <noinclude>FOO</noinclude>
7308 <onlyinclude>FOO</onlyinclude>
7309
7310 But not inside includeonly
7311 <includeonly>{{subst:Foo}}</includeonly>
7312 !! end
7313
7314 ###
7315 ### Message transform tests
7316 ###
7317 !! test
7318 message transform: magic variables
7319 !! options
7320 msg
7321 !! input
7322 {{SITENAME}}
7323 !! result
7324 MediaWiki
7325 !! end
7326
7327 !! test
7328 message transform: should not transform wiki markup
7329 !! options
7330 msg
7331 !! input
7332 ''test''
7333 !! result
7334 ''test''
7335 !! end
7336
7337 !! test
7338 message transform: <noinclude> in transcluded template (bug 4926)
7339 !! options
7340 msg
7341 !! input
7342 {{Includes}}
7343 !! result
7344 Foobar
7345 !! end
7346
7347 !! test
7348 message transform: <onlyinclude> in transcluded template (bug 4926)
7349 !! options
7350 msg
7351 !! input
7352 {{Includes2}}
7353 !! result
7354 Foo
7355 !! end
7356
7357 !! test
7358 {{#special:}} page name, known
7359 !! options
7360 msg
7361 !! input
7362 {{#special:Recentchanges}}
7363 !! result
7364 Special:RecentChanges
7365 !! end
7366
7367 !! test
7368 {{#special:}} page name with subpage, known
7369 !! options
7370 msg
7371 !! input
7372 {{#special:Recentchanges/param}}
7373 !! result
7374 Special:RecentChanges/param
7375 !! end
7376
7377 !! test
7378 {{#special:}} page name, unknown
7379 !! options
7380 msg
7381 !! input
7382 {{#special:foobarnonexistent}}
7383 !! result
7384 No such special page
7385 !! end
7386
7387 !! test
7388 {{#speciale:}} page name, known
7389 !! options
7390 msg
7391 !! input
7392 {{#speciale:Recentchanges}}
7393 !! result
7394 Special:RecentChanges
7395 !! end
7396
7397 !! test
7398 {{#speciale:}} page name with subpage, known
7399 !! options
7400 msg
7401 !! input
7402 {{#speciale:Recentchanges/param}}
7403 !! result
7404 Special:RecentChanges/param
7405 !! end
7406
7407 !! test
7408 {{#speciale:}} page name, unknown
7409 !! options
7410 msg
7411 !! input
7412 {{#speciale:foobarnonexistent}}
7413 !! result
7414 No_such_special_page
7415 !! end
7416
7417 ###
7418 ### Images
7419 ###
7420 !! test
7421 Simple image
7422 !! input
7423 [[Image:foobar.jpg]]
7424 !! result
7425 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7426 </p>
7427 !! end
7428
7429 !! test
7430 Right-aligned image
7431 !! input
7432 [[Image:foobar.jpg|right]]
7433 !! result
7434 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7435
7436 !! end
7437
7438 !! test
7439 Simple image (using File: namespace, now canonical)
7440 !! input
7441 [[File:foobar.jpg]]
7442 !! result
7443 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7444 </p>
7445 !! end
7446
7447 !! test
7448 Image with caption
7449 !! input
7450 [[Image:foobar.jpg|right|Caption text]]
7451 !! result
7452 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7453
7454 !! end
7455
7456 !! test
7457 Image with empty attribute
7458 !! input
7459 [[Image:foobar.jpg|right||Caption text]]
7460 !! result
7461 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7462
7463 !! end
7464
7465 !! test
7466 Image with link tails
7467 !! input
7468 123[[Image:foobar.jpg]]456
7469 123[[Image:foobar.jpg|right]]456
7470 123[[Image:foobar.jpg|thumb]]456
7471 !! result
7472 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
7473 </p>
7474 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
7475 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
7476
7477 !! end
7478
7479 !! test
7480 Image with multiple captions -- only last one is accepted
7481 !! input
7482 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7483 !! result
7484 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7485
7486 !! end
7487
7488 !! test
7489 Image with width attribute at different positions
7490 !! input
7491 [[Image:foobar.jpg|200px|right|Caption]]
7492 [[Image:foobar.jpg|right|200px|Caption]]
7493 [[Image:foobar.jpg|right|Caption|200px]]
7494 !! result
7495 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7496 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7497 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7498
7499 !! end
7500
7501 !! test
7502 Image with link parameter, wiki target
7503 !! input
7504 [[Image:foobar.jpg|link=Target page]]
7505 !! result
7506 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7507 </p>
7508 !! end
7509
7510 !! test
7511 Image with link parameter, URL target
7512 !! input
7513 [[Image:foobar.jpg|link=http://example.com/]]
7514 !! result
7515 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7516 </p>
7517 !! end
7518
7519 !! test
7520 Image with link parameter, wgExternalLinkTarget
7521 !! input
7522 [[Image:foobar.jpg|link=http://example.com/]]
7523 !! config
7524 wgExternalLinkTarget='foobar'
7525 !! result
7526 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7527 </p>
7528 !! end
7529
7530 !! test
7531 Image with link parameter, wgNoFollowLinks set to false
7532 !! input
7533 [[Image:foobar.jpg|link=http://example.com/]]
7534 !! config
7535 wgNoFollowLinks=false
7536 !! result
7537 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7538 </p>
7539 !! end
7540
7541 !! test
7542 Image with link parameter, wgNoFollowDomainExceptions
7543 !! input
7544 [[Image:foobar.jpg|link=http://example.com/]]
7545 !! config
7546 wgNoFollowDomainExceptions='example.com'
7547 !! result
7548 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7549 </p>
7550 !! end
7551
7552 !! test
7553 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7554 !! input
7555 [[Image:foobar.jpg|link=http://example.com/|Title]]
7556 !! config
7557 wgExternalLinkTarget='foobar'
7558 !! result
7559 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7560 </p>
7561 !! end
7562
7563 !! test
7564 Image with empty link parameter
7565 !! input
7566 [[Image:foobar.jpg|link=]]
7567 !! result
7568 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7569 </p>
7570 !! end
7571
7572 !! test
7573 Image with link parameter (wiki target) and unnamed parameter
7574 !! input
7575 [[Image:foobar.jpg|link=Target page|Title]]
7576 !! result
7577 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7578 </p>
7579 !! end
7580
7581 !! test
7582 Image with link parameter (URL target) and unnamed parameter
7583 !! input
7584 [[Image:foobar.jpg|link=http://example.com/|Title]]
7585 !! result
7586 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7587 </p>
7588 !! end
7589
7590 !! test
7591 Thumbnail image with link parameter
7592 !! options
7593 php
7594 !! input
7595 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7596 !! result
7597 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7598
7599 !! end
7600
7601 !! test
7602 Manually-specified thumbnail image
7603 !! options
7604 php
7605 !! input
7606 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7607 !! result
7608 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7609
7610 !! end
7611
7612 !! test
7613 Manually-specified thumbnail image with explicit link to wiki page
7614 !! options
7615 php
7616 !! input
7617 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7618 !! result
7619 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7620
7621 !! end
7622
7623 !! test
7624 Manually-specified thumbnail image with explicit link to url
7625 !! options
7626 php
7627 !! input
7628 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7629 !! result
7630 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7631
7632 !! end
7633
7634 !! test
7635 Manually-specified thumbnail image with explicit no link
7636 !! options
7637 php
7638 !! input
7639 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7640 !! result
7641 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7642
7643 !! end
7644
7645 !! test
7646 Manually-specified thumbnail image with explicit link and alt text
7647 !! options
7648 php
7649 !! input
7650 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7651 !! result
7652 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7653
7654 !! end
7655
7656 !! test
7657 Image with frame and link
7658 !! input
7659 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7660 !! result
7661 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7662
7663 !! end
7664
7665 !! test
7666 Image with frame and link and explicit alt
7667 !! input
7668 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7669 !! result
7670 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7671
7672 !! end
7673
7674 !! test
7675 Image with wiki markup in implicit alt
7676 !! input
7677 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7678 !! result
7679 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7680 </p>
7681 !! end
7682
7683 !! test
7684 Image with wiki markup in explicit alt
7685 !! input
7686 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7687 !! result
7688 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7689 </p>
7690 !! end
7691
7692 !! test
7693 Link to image page- image page normally doesn't exists, hence edit link
7694 Add test with existing image page
7695 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7696 !! input
7697 [[:Image:test]]
7698 !! result
7699 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
7700 </p>
7701 !! end
7702
7703 !! test
7704 bug 18784 Link to non-existent image page with caption should use caption as link text
7705 !! input
7706 [[:Image:test|caption]]
7707 !! result
7708 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
7709 </p>
7710 !! end
7711
7712 !! test
7713 Frameless image caption with a free URL
7714 !! input
7715 [[Image:foobar.jpg|http://example.com]]
7716 !! result
7717 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7718 </p>
7719 !! end
7720
7721 !! test
7722 Thumbnail image caption with a free URL
7723 !! input
7724 [[Image:foobar.jpg|thumb|http://example.com]]
7725 !! result
7726 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7727
7728 !! end
7729
7730 !! test
7731 Thumbnail image caption with a free URL and explicit alt
7732 !! input
7733 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7734 !! result
7735 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7736
7737 !! end
7738
7739 !! test
7740 BUG 1887: A ISBN with a thumbnail
7741 !! input
7742 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7743 !! result
7744 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
7745
7746 !! end
7747
7748 !! test
7749 BUG 1887: A RFC with a thumbnail
7750 !! input
7751 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7752 !! result
7753 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
7754
7755 !! end
7756
7757 !! test
7758 BUG 1887: A mailto link with a thumbnail
7759 !! input
7760 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7761 !! result
7762 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
7763
7764 !! end
7765
7766 # Pending resolution to bug 368
7767 !! test
7768 BUG 648: Frameless image caption with a link
7769 !! input
7770 [[Image:foobar.jpg|text with a [[link]] in it]]
7771 !! result
7772 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7773 </p>
7774 !! end
7775
7776 !! test
7777 BUG 648: Frameless image caption with a link (suffix)
7778 !! input
7779 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7780 !! result
7781 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7782 </p>
7783 !! end
7784
7785 !! test
7786 BUG 648: Frameless image caption with an interwiki link
7787 !! input
7788 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7789 !! result
7790 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7791 </p>
7792 !! end
7793
7794 !! test
7795 BUG 648: Frameless image caption with a piped interwiki link
7796 !! input
7797 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7798 !! result
7799 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7800 </p>
7801 !! end
7802
7803 !! test
7804 Escape HTML special chars in image alt text
7805 !! input
7806 [[Image:foobar.jpg|& < > "]]
7807 !! result
7808 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7809 </p>
7810 !! end
7811
7812 !! test
7813 BUG 499: Alt text should have &#1234;, not &amp;1234;
7814 !! input
7815 [[Image:foobar.jpg|&#9792;]]
7816 !! result
7817 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7818 </p>
7819 !! end
7820
7821 !! test
7822 Broken image caption with link
7823 !! input
7824 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7825 !! result
7826 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
7827 </p>
7828 !! end
7829
7830 !! test
7831 Image caption containing another image
7832 !! input
7833 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7834 !! result
7835 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
7836
7837 !! end
7838
7839 !! test
7840 Image caption containing a newline
7841 !! input
7842 [[Image:Foobar.jpg|This
7843 *is some text]]
7844 !! result
7845 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7846 </p>
7847 !!end
7848
7849 !!test
7850 Parsoid: Image caption containing leading space
7851 (The leading space should not trigger nowiki escaping in wt2wt mode)
7852 !! input
7853 [[Image:Foobar.jpg|thumb| bar]]
7854 !! result
7855 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
7856
7857 !!end
7858
7859 !! test
7860 Bug 3090: External links other than http: in image captions
7861 !! input
7862 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7863 !! result
7864 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
7865
7866 !! end
7867
7868 !! test
7869 Custom class
7870 !! input
7871 [[Image:foobar.jpg|a|class=b]]
7872 !! result
7873 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
7874 </p>
7875 !! end
7876
7877 !! test
7878 Localized image handling (1).
7879 !! options
7880 language=es
7881 !! input
7882 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7883 !! result
7884 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7885
7886 !! end
7887
7888 !! test
7889 Localized image handling (2).
7890 !! options
7891 language=es
7892 !! input
7893 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7894 !! result
7895 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
7896
7897 !! end
7898
7899 !! test
7900 "border", "frameless" and "class" attributes on an image.
7901 !! input
7902 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7903 !! result
7904 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
7905 </p>
7906 !! end
7907
7908 !! article
7909 File:Barfoo.jpg
7910 !! text
7911 #REDIRECT [[File:Barfoo.jpg]]
7912 !! endarticle
7913
7914 !! test
7915 Redirected image
7916 !! input
7917 [[Image:Barfoo.jpg]]
7918 !! result
7919 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7920 </p>
7921 !! end
7922
7923 !! test
7924 Missing image with uploads disabled
7925 !! options
7926 wgEnableUploads=0
7927 !! input
7928 [[Image:Foobaz.jpg]]
7929 !! result
7930 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7931 </p>
7932 !! end
7933
7934
7935 ###
7936 ### Subpages
7937 ###
7938 !! article
7939 Subpage test/subpage
7940 !! text
7941 foo
7942 !! endarticle
7943
7944 !! test
7945 Subpage link
7946 !! options
7947 subpage title=[[Subpage test]]
7948 !! input
7949 [[/subpage]]
7950 !! result
7951 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7952 </p>
7953 !! end
7954
7955 !! test
7956 Subpage noslash link
7957 !! options
7958 subpage title=[[Subpage test]]
7959 !!input
7960 [[/subpage/]]
7961 !! result
7962 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7963 </p>
7964 !! end
7965
7966 !! test
7967 Disabled subpages
7968 !! input
7969 [[/subpage]]
7970 !! result
7971 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7972 </p>
7973 !! end
7974
7975 !! test
7976 BUG 561: {{/Subpage}}
7977 !! options
7978 subpage title=[[Page]]
7979 !! input
7980 {{/Subpage}}
7981 !! result
7982 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
7983 </p>
7984 !! end
7985
7986 ###
7987 ### Categories
7988 ###
7989 !! article
7990 Category:MediaWiki User's Guide
7991 !! text
7992 blah
7993 !! endarticle
7994
7995 !! test
7996 Link to category
7997 !! input
7998 [[:Category:MediaWiki User's Guide]]
7999 !! result
8000 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8001 </p>
8002 !! end
8003
8004 !! test
8005 Simple category
8006 !! options
8007 cat
8008 !! input
8009 [[Category:MediaWiki User's Guide]]
8010 !! result
8011 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8012 !! end
8013
8014 !! test
8015 PAGESINCATEGORY invalid title fatal (r33546 fix)
8016 !! input
8017 {{PAGESINCATEGORY:<bogus>}}
8018 !! result
8019 <p>0
8020 </p>
8021 !! end
8022
8023 !! test
8024 Category with different sort key
8025 !! options
8026 cat
8027 !! input
8028 [[Category:MediaWiki User's Guide|Foo]]
8029 !! result
8030 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8031 !! end
8032
8033 !! test
8034 Category with identical sort key
8035 !! options
8036 cat
8037 !! input
8038 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8039 !! result
8040 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8041 !! end
8042
8043 !! test
8044 Category with empty sort key
8045 !! options
8046 cat
8047 pst
8048 !! input
8049 [[Category:MediaWiki User's Guide|]]
8050 !! result
8051 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8052 !! end
8053
8054 !! test
8055 Category with empty sort key and parentheses
8056 !! options
8057 cat
8058 pst
8059 !! input
8060 [[Category:Foo (bar)|]]
8061 !! result
8062 [[Category:Foo (bar)|Foo]]
8063 !! end
8064
8065 !! test
8066 Category with link tail
8067 !! options
8068 cat
8069 pst
8070 !! input
8071 123[[Category:Foo]]456
8072 !! result
8073 123[[Category:Foo]]456
8074 !! end
8075
8076 !! test
8077 Category with template
8078 !! options
8079 cat
8080 pst
8081 !! input
8082 [[Category:{{echo|Foo}}]]
8083 !! result
8084 [[Category:{{echo|Foo}}]]
8085 !! end
8086
8087 !! test
8088 Category with template in sort key
8089 !! options
8090 cat
8091 pst
8092 !! input
8093 [[Category:Foo|{{echo|Bar}}]]
8094 !! result
8095 [[Category:Foo|{{echo|Bar}}]]
8096 !! end
8097
8098 !! test
8099 Category with template in sort key and title
8100 !! options
8101 cat
8102 pst
8103 !! input
8104 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8105 !! result
8106 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8107 !! end
8108
8109 !! test
8110 Category / paragraph interactions
8111 !! input
8112 Foo [[Category:Baz]] Bar
8113
8114 Foo [[Category:Baz]]
8115 Bar
8116
8117 Foo
8118 [[Category:Baz]]
8119 Bar
8120
8121 Foo
8122 [[Category:Baz]] Bar
8123
8124 Foo
8125 [[Category:Baz]]
8126 [[Category:Baz]]
8127 [[Category:Baz]]
8128 Bar
8129
8130 [[Category:Baz]]
8131 [[Category:Baz]]
8132 [[Category:Baz]]
8133
8134 [[Category:Baz]]
8135 {{echo|[[Category:Baz]]}}
8136 [[Category:Baz]]
8137 !! result
8138 <p>Foo Bar
8139 </p><p>Foo
8140 Bar
8141 </p><p>Foo
8142 Bar
8143 </p><p>Foo Bar
8144 </p><p>Foo
8145 Bar
8146 </p>
8147 !! end
8148
8149 ###
8150 ### Inter-language links
8151 ###
8152 !! test
8153 Inter-language links
8154 !! options
8155 ill
8156 !! input
8157 [[es:Alimento]]
8158 [[fr:Nourriture]]
8159 [[zh:&#39135;&#21697;]]
8160 !! result
8161 es:Alimento fr:Nourriture zh:食品
8162 !! end
8163
8164 !! test
8165 Duplicate interlanguage links (bug 24502)
8166 !! options
8167 ill
8168 !! input
8169 [[es:1]]
8170 [[es:2]]
8171 [[fr:1]]
8172 [[fr:2]]
8173 !! result
8174 es:1 fr:1
8175 !! end
8176
8177 ###
8178 ### Sections
8179 ###
8180 !! test
8181 Basic section headings
8182 !! input
8183 == Headline 1 ==
8184 Some text
8185
8186 ==Headline 2==
8187 More
8188 ===Smaller headline===
8189 Blah blah
8190 !! result
8191 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8192 <p>Some text
8193 </p>
8194 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span></h2>
8195 <p>More
8196 </p>
8197 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span></h3>
8198 <p>Blah blah
8199 </p>
8200 !! end
8201
8202 !! test
8203 Section headings with TOC
8204 !! input
8205 == Headline 1 ==
8206 === Subheadline 1 ===
8207 ===== Skipping a level =====
8208 ====== Skipping a level ======
8209
8210 == Headline 2 ==
8211 Some text
8212 ===Another headline===
8213 !! result
8214 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8215 <ul>
8216 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8217 <ul>
8218 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8219 <ul>
8220 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
8221 <ul>
8222 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
8223 </ul>
8224 </li>
8225 </ul>
8226 </li>
8227 </ul>
8228 </li>
8229 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8230 <ul>
8231 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8232 </ul>
8233 </li>
8234 </ul>
8235 </td></tr></table>
8236 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8237 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span></h3>
8238 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span></h5>
8239 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span></h6>
8240 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span></h2>
8241 <p>Some text
8242 </p>
8243 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span></h3>
8244
8245 !! end
8246
8247 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8248 !! test
8249 Handling of sections up to level 6 and beyond
8250 !! input
8251 = Level 1 Heading=
8252 == Level 2 Heading==
8253 === Level 3 Heading===
8254 ==== Level 4 Heading====
8255 ===== Level 5 Heading=====
8256 ====== Level 6 Heading======
8257 ======= Level 7 Heading=======
8258 ======== Level 8 Heading========
8259 ========= Level 9 Heading=========
8260 ========== Level 10 Heading==========
8261 !! result
8262 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8263 <ul>
8264 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8265 <ul>
8266 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
8267 <ul>
8268 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
8269 <ul>
8270 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
8271 <ul>
8272 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
8273 <ul>
8274 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
8275 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
8276 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
8277 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
8278 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
8279 </ul>
8280 </li>
8281 </ul>
8282 </li>
8283 </ul>
8284 </li>
8285 </ul>
8286 </li>
8287 </ul>
8288 </li>
8289 </ul>
8290 </td></tr></table>
8291 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span></h1>
8292 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span></h2>
8293 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span></h3>
8294 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span></h4>
8295 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span></h5>
8296 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span></h6>
8297 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span></h6>
8298 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span></h6>
8299 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span></h6>
8300 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span></h6>
8301
8302 !! end
8303
8304 !! test
8305 TOC regression (bug 9764)
8306 !! input
8307 == title 1 ==
8308 === title 1.1 ===
8309 ==== title 1.1.1 ====
8310 === title 1.2 ===
8311 == title 2 ==
8312 === title 2.1 ===
8313 !! result
8314 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8315 <ul>
8316 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8317 <ul>
8318 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
8319 <ul>
8320 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
8321 </ul>
8322 </li>
8323 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8324 </ul>
8325 </li>
8326 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8327 <ul>
8328 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8329 </ul>
8330 </li>
8331 </ul>
8332 </td></tr></table>
8333 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8334 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8335 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8336 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8337 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8338 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8339
8340 !! end
8341
8342 !! test
8343 TOC with wgMaxTocLevel=3 (bug 6204)
8344 !! options
8345 wgMaxTocLevel=3
8346 !! input
8347 == title 1 ==
8348 === title 1.1 ===
8349 ==== title 1.1.1 ====
8350 === title 1.2 ===
8351 == title 2 ==
8352 === title 2.1 ===
8353 !! result
8354 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8355 <ul>
8356 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8357 <ul>
8358 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8359 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8360 </ul>
8361 </li>
8362 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8363 <ul>
8364 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8365 </ul>
8366 </li>
8367 </ul>
8368 </td></tr></table>
8369 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8370 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8371 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8372 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8373 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8374 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8375
8376 !! end
8377
8378 !! test
8379 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8380 !! options
8381 wgMaxTocLevel=3
8382 !! input
8383 ==Section 1==
8384 ===Section 1.1===
8385 ====Section 1.1.1====
8386 ====Section 1.1.1.1====
8387 ==Section 2==
8388 !! result
8389 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8390 <ul>
8391 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8392 <ul>
8393 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
8394 </ul>
8395 </li>
8396 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8397 </ul>
8398 </td></tr></table>
8399 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
8400 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span></h3>
8401 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span></h4>
8402 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span></h4>
8403 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span></h2>
8404
8405 !! end
8406
8407
8408 !! test
8409 Resolving duplicate section names
8410 !! input
8411 == Foo bar ==
8412 == Foo bar ==
8413 !! result
8414 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8415 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span></h2>
8416
8417 !! end
8418
8419 !! test
8420 Resolving duplicate section names with differing case (bug 10721)
8421 !! input
8422 == Foo bar ==
8423 == Foo Bar ==
8424 !! result
8425 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8426 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
8427
8428 !! end
8429
8430 !! article
8431 Template:sections
8432 !! text
8433 ===Section 1===
8434 ==Section 2==
8435 !! endarticle
8436
8437 !! test
8438 Template with sections, __NOTOC__
8439 !! input
8440 __NOTOC__
8441 ==Section 0==
8442 {{sections}}
8443 ==Section 4==
8444 !! result
8445 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span></h2>
8446 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span></h3>
8447 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span></h2>
8448 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span></h2>
8449
8450 !! end
8451
8452 !! test
8453 __NOEDITSECTION__ keyword
8454 !! input
8455 __NOEDITSECTION__
8456 ==Section 1==
8457 ==Section 2==
8458 !! result
8459 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
8460 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
8461
8462 !! end
8463
8464 !! test
8465 Link inside a section heading
8466 !! input
8467 ==Section with a [[Main Page|link]] in it==
8468 !! result
8469 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span></h2>
8470
8471 !! end
8472
8473 !! test
8474 TOC regression (bug 12077)
8475 !! input
8476 __TOC__
8477 == title 1 ==
8478 === title 1.1 ===
8479 == title 2 ==
8480 !! result
8481 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8482 <ul>
8483 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8484 <ul>
8485 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8486 </ul>
8487 </li>
8488 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8489 </ul>
8490 </td></tr></table>
8491 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8492 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8493 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span></h2>
8494
8495 !! end
8496
8497 !! test
8498 BUG 1219 URL next to image (good)
8499 !! input
8500 http://example.com [[Image:foobar.jpg]]
8501 !! result
8502 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8503 </p>
8504 !!end
8505
8506 !! test
8507 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8508 !! input
8509 ===
8510 The line above must have a trailing space!
8511 === <!--
8512 --> <!-- -->
8513 But just in case it doesn't...
8514 !! result
8515 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span></h1>
8516 <p>The line above must have a trailing space!
8517 </p>
8518 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span></h1>
8519 <p>But just in case it doesn't...
8520 </p>
8521 !! end
8522
8523 !! test
8524 Header with special characters (bug 25462)
8525 !! input
8526 The tooltips shall not show entities to the user (ie. be double escaped)
8527
8528 == text > text ==
8529 section 1
8530
8531 == text < text ==
8532 section 2
8533
8534 == text & text ==
8535 section 3
8536
8537 == text ' text ==
8538 section 4
8539
8540 == text " text ==
8541 section 5
8542 !! result
8543 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8544 </p>
8545 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8546 <ul>
8547 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
8548 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
8549 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
8550 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8551 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8552 </ul>
8553 </td></tr></table>
8554 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span></h2>
8555 <p>section 1
8556 </p>
8557 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span></h2>
8558 <p>section 2
8559 </p>
8560 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span></h2>
8561 <p>section 3
8562 </p>
8563 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span></h2>
8564 <p>section 4
8565 </p>
8566 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span></h2>
8567 <p>section 5
8568 </p>
8569 !! end
8570
8571 !! test
8572 Headers with excess '=' characters
8573 (Are similar tests necessary beyond the 1st level?)
8574 !! input
8575 =foo==
8576 ==foo=
8577 =''italic'' heading==
8578 ==''italic'' heading=
8579 !! result
8580 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8581 <ul>
8582 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8583 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8584 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
8585 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
8586 </ul>
8587 </td></tr></table>
8588 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span></h1>
8589 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span></h1>
8590 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span></h1>
8591 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span></h1>
8592
8593 !! end
8594
8595 !! test
8596 HTML headers vs TOC (bug 23393)
8597 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8598 !! input
8599 <h1>Header 1</h1>
8600 == Header 1.1 ==
8601 == Header 1.2 ==
8602
8603 <h1>Header 2
8604 </h1>
8605 == Header 2.1 ==
8606 == Header 2.2 ==
8607 __NOEDITSECTION__
8608 !! result
8609 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8610 <ul>
8611 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8612 <ul>
8613 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
8614 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
8615 </ul>
8616 </li>
8617 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8618 <ul>
8619 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
8620 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
8621 </ul>
8622 </li>
8623 </ul>
8624 </td></tr></table>
8625 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
8626 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8627 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8628 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
8629 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8630 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8631
8632 !! end
8633
8634 !! test
8635 BUG 1219 URL next to image (broken)
8636 !! input
8637 http://example.com[[Image:foobar.jpg]]
8638 !! result
8639 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8640 </p>
8641 !!end
8642
8643 !! test
8644 Bug 1186 news: in the middle of text
8645 !! input
8646 http://en.wikinews.org/wiki/Wikinews:Workplace
8647 !! result
8648 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8649 </p>
8650 !!end
8651
8652
8653 !! test
8654 Namespaced link must have a title
8655 !! input
8656 [[Project:]]
8657 !! result
8658 <p>[[Project:]]
8659 </p>
8660 !!end
8661
8662 !! test
8663 Namespaced link must have a title (bad fragment version)
8664 !! input
8665 [[Project:#fragment]]
8666 !! result
8667 <p>[[Project:#fragment]]
8668 </p>
8669 !!end
8670
8671
8672 ###
8673 ### HTML tags and HTML attributes
8674 ###
8675
8676 !! test
8677 div with no attributes
8678 !! input
8679 <div>HTML rocks</div>
8680 !! result
8681 <div>HTML rocks</div>
8682
8683 !! end
8684
8685 !! test
8686 div with double-quoted attribute
8687 !! input
8688 <div id="rock">HTML rocks</div>
8689 !! result
8690 <div id="rock">HTML rocks</div>
8691
8692 !! end
8693
8694 !! test
8695 div with single-quoted attribute
8696 !! input
8697 <div id='rock'>HTML rocks</div>
8698 !! result
8699 <div id="rock">HTML rocks</div>
8700
8701 !! end
8702
8703 !! test
8704 div with unquoted attribute
8705 !! input
8706 <div id=rock>HTML rocks</div>
8707 !! result
8708 <div id="rock">HTML rocks</div>
8709
8710 !! end
8711
8712 !! test
8713 div with illegal double attributes
8714 !! input
8715 <div id="a" id="b">HTML rocks</div>
8716 !! result
8717 <div id="b">HTML rocks</div>
8718
8719 !!end
8720
8721 # FIXME: produce empty string instead of "class" in the PHP parser, following
8722 # the HTML5 spec.
8723 !! test
8724 div with empty attribute value, space before equals
8725 !! options
8726 parsoid
8727 !! input
8728 <div class =>HTML rocks</div>
8729 !! result
8730 <div class="">HTML rocks</div>
8731
8732 !! end
8733
8734 # The PHP parser escapes the opening brace to &#123; for some reason, so
8735 # disabled this test for it.
8736 !! test
8737 div with braces in attribute value
8738 !! options
8739 parsoid
8740 !! input
8741 <div title="{}">Foo</div>
8742 !! result
8743 <div title="{}">Foo</div>
8744 !! end
8745
8746 # This it very inconsistent in the PHP parser: it returns
8747 # class="class" if there is a space between the name and the equal sign (see
8748 # 'div with empty attribute value, space before equals'), but strips the
8749 # attribute completely if the space is missing. We hope that not much content
8750 # depends on this, so are implementing the behavior below in Parsoid for
8751 # consistencies' sake. Disabled for the PHP parser.
8752 # FIXME: fix this behavior in the PHP parser?
8753 !! test
8754 div with empty attribute value, no space before equals
8755 !! options
8756 parsoid
8757 !! input
8758 <div class=>HTML rocks</div>
8759 !! result
8760 <div class="">HTML rocks</div>
8761
8762 !! end
8763
8764 !! test
8765 HTML multiple attributes correction
8766 !! input
8767 <p class="error" class="awesome">Awesome!</p>
8768 !! result
8769 <p class="awesome">Awesome!</p>
8770
8771 !!end
8772
8773 !! test
8774 Table multiple attributes correction
8775 !! input
8776 {|
8777 !+ class="error" class="awesome"| status
8778 |}
8779 !! result
8780 <table>
8781 <tr>
8782 <th class="awesome"> status
8783 </th></tr></table>
8784
8785 !!end
8786
8787 !! test
8788 DIV IN UPPERCASE
8789 !! input
8790 <DIV ID="x">HTML ROCKS</DIV>
8791 !! result
8792 <div id="x">HTML ROCKS</div>
8793
8794 !!end
8795
8796 !! test
8797 Non-ASCII pseudo-tags are rendered as text
8798 !! input
8799 <khyô>
8800 !! result
8801 <p>&lt;khyô&gt;
8802 </p>
8803 !! end
8804
8805 !! test
8806 Pseudo-tag with URL 'name' renders as url link
8807 !! input
8808 <http://example.com/>
8809 !! result
8810 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8811 </p>
8812 !! end
8813
8814 !! test
8815 text with amp in the middle of nowhere
8816 !! input
8817 Remember AT&T?
8818 !!result
8819 <p>Remember AT&amp;T?
8820 </p>
8821 !! end
8822
8823 !! test
8824 text with character entity: eacute
8825 !! input
8826 I always thought &eacute; was a cute letter.
8827 !! result
8828 <p>I always thought &#233; was a cute letter.
8829 </p>
8830 !! end
8831
8832 !! test
8833 text with entity-escaped character entity-like string: eacute
8834 !! input
8835 I always thought &amp;eacute; was a cute letter.
8836 !! result
8837 <p>I always thought &amp;eacute; was a cute letter.
8838 </p>
8839 !! end
8840
8841 !! test
8842 text with undefined character entity: xacute
8843 !! input
8844 I always thought &xacute; was a cute letter.
8845 !! result
8846 <p>I always thought &amp;xacute; was a cute letter.
8847 </p>
8848 !! end
8849
8850
8851 ###
8852 ### Media links
8853 ###
8854
8855 !! test
8856 Media link
8857 !! input
8858 [[Media:Foobar.jpg]]
8859 !! result
8860 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8861 </p>
8862 !! end
8863
8864 !! test
8865 Media link with text
8866 !! input
8867 [[Media:Foobar.jpg|A neat file to look at]]
8868 !! result
8869 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8870 </p>
8871 !! end
8872
8873 # FIXME: this is still bad HTML tag nesting
8874 !! test
8875 Media link with nasty text
8876 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8877 !! input
8878 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8879 !! result
8880 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
8881
8882 !! end
8883
8884 !! test
8885 Media link to nonexistent file (bug 1702)
8886 !! input
8887 [[Media:No such.jpg]]
8888 !! result
8889 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8890 </p>
8891 !! end
8892
8893 !! test
8894 Image link to nonexistent file (bug 1850 - good)
8895 !! input
8896 [[Image:No such.jpg]]
8897 !! result
8898 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
8899 </p>
8900 !! end
8901
8902 !! test
8903 :Image link to nonexistent file (bug 1850 - bad)
8904 !! input
8905 [[:Image:No such.jpg]]
8906 !! result
8907 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
8908 </p>
8909 !! end
8910
8911
8912
8913 !! test
8914 Character reference normalization in link text (bug 1938)
8915 !! input
8916 [[Main Page|this&that]]
8917 !! result
8918 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8919 </p>
8920 !!end
8921
8922 !! article
8923 אַ
8924 !! text
8925 Test for unicode normalization
8926
8927 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8928 !! endarticle
8929
8930 !! test
8931 (bug 19451) Links should refer to the normalized form.
8932 !! input
8933 [[&#xFB2E;]]
8934 [[&#x5d0;&#x5b7;]]
8935 [[&#x5d0;ַ]]
8936 [[א&#x5b7;]]
8937 [[אַ]]
8938 !! result
8939 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8940 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8941 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8942 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8943 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8944 </p>
8945 !! end
8946
8947 !! test
8948 Empty attribute crash test (bug 2067)
8949 !! input
8950 <font color="">foo</font>
8951 !! result
8952 <p><font color="">foo</font>
8953 </p>
8954 !! end
8955
8956 !! test
8957 Empty attribute crash test single-quotes (bug 2067)
8958 !! input
8959 <font color=''>foo</font>
8960 !! result
8961 <p><font color="">foo</font>
8962 </p>
8963 !! end
8964
8965 !! test
8966 Attribute test: equals, then nothing
8967 !! input
8968 <font color=>foo</font>
8969 !! result
8970 <p><font>foo</font>
8971 </p>
8972 !! end
8973
8974 !! test
8975 Attribute test: unquoted value
8976 !! input
8977 <font color=x>foo</font>
8978 !! result
8979 <p><font color="x">foo</font>
8980 </p>
8981 !! end
8982
8983 !! test
8984 Attribute test: unquoted but illegal value (hash)
8985 !! input
8986 <font color=#x>foo</font>
8987 !! result
8988 <p><font color="#x">foo</font>
8989 </p>
8990 !! end
8991
8992 !! test
8993 Attribute test: no value
8994 !! input
8995 <font color>foo</font>
8996 !! result
8997 <p><font color="color">foo</font>
8998 </p>
8999 !! end
9000
9001 !! test
9002 Bug 2095: link with three closing brackets
9003 !! input
9004 [[Main Page]]]
9005 !! result
9006 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9007 </p>
9008 !! end
9009
9010 !! test
9011 Bug 2095: link with pipe and three closing brackets
9012 !! input
9013 [[Main Page|link]]]
9014 !! result
9015 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9016 </p>
9017 !! end
9018
9019 !! test
9020 Bug 2095: link with pipe and three closing brackets, version 2
9021 !! input
9022 [[Main Page|[http://example.com/]]]
9023 !! result
9024 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9025 </p>
9026 !! end
9027
9028
9029 ###
9030 ### Safety
9031 ###
9032
9033 !! article
9034 Template:Dangerous attribute
9035 !! text
9036 " onmouseover="alert(document.cookie)
9037 !! endarticle
9038
9039 !! article
9040 Template:Dangerous style attribute
9041 !! text
9042 border-size: expression(alert(document.cookie))
9043 !! endarticle
9044
9045 !! article
9046 Template:Div style
9047 !! text
9048 <div style="float: right; {{{1}}}">Magic div</div>
9049 !! endarticle
9050
9051 !! test
9052 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9053 !! input
9054 <div title="{{test}}"></div>
9055 !! result
9056 <div title="This is a test template"></div>
9057
9058 !! end
9059
9060 !! test
9061 Bug 2304: HTML attribute safety (dangerous template; 2309)
9062 !! input
9063 <div title="{{dangerous attribute}}"></div>
9064 !! result
9065 <div title=""></div>
9066
9067 !! end
9068
9069 !! test
9070 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9071 !! input
9072 <div style="{{dangerous style attribute}}"></div>
9073 !! result
9074 <div style="/* insecure input */"></div>
9075
9076 !! end
9077
9078 !! test
9079 Bug 2304: HTML attribute safety (safe parameter; 2309)
9080 !! input
9081 {{div style|width: 200px}}
9082 !! result
9083 <div style="float: right; width: 200px">Magic div</div>
9084
9085 !! end
9086
9087 !! test
9088 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9089 !! input
9090 {{div style|width: expression(alert(document.cookie))}}
9091 !! result
9092 <div style="/* insecure input */">Magic div</div>
9093
9094 !! end
9095
9096 !! test
9097 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9098 !! input
9099 {{div style|"><script>alert(document.cookie)</script>}}
9100 !! result
9101 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9102
9103 !! end
9104
9105 !! test
9106 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9107 !! input
9108 {{div style|" ><script>alert(document.cookie)</script>}}
9109 !! result
9110 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9111
9112 !! end
9113
9114 !! test
9115 Bug 2304: HTML attribute safety (link)
9116 !! input
9117 <div title="[[Main Page]]"></div>
9118 !! result
9119 <div title="&#91;&#91;Main Page]]"></div>
9120
9121 !! end
9122
9123 !! test
9124 Bug 2304: HTML attribute safety (italics)
9125 !! input
9126 <div title="''foobar''"></div>
9127 !! result
9128 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9129
9130 !! end
9131
9132 !! test
9133 Bug 2304: HTML attribute safety (bold)
9134 !! input
9135 <div title="'''foobar'''"></div>
9136 !! result
9137 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9138
9139 !! end
9140
9141
9142 !! test
9143 Bug 2304: HTML attribute safety (ISBN)
9144 !! input
9145 <div title="ISBN 1234567890"></div>
9146 !! result
9147 <div title="&#73;SBN 1234567890"></div>
9148
9149 !! end
9150
9151 !! test
9152 Bug 2304: HTML attribute safety (RFC)
9153 !! input
9154 <div title="RFC 1234"></div>
9155 !! result
9156 <div title="&#82;FC 1234"></div>
9157
9158 !! end
9159
9160 !! test
9161 Bug 2304: HTML attribute safety (PMID)
9162 !! input
9163 <div title="PMID 1234567890"></div>
9164 !! result
9165 <div title="&#80;MID 1234567890"></div>
9166
9167 !! end
9168
9169 !! test
9170 Bug 2304: HTML attribute safety (web link)
9171 !! input
9172 <div title="http://example.com/"></div>
9173 !! result
9174 <div title="http&#58;//example.com/"></div>
9175
9176 !! end
9177
9178 !! test
9179 Bug 2304: HTML attribute safety (named web link)
9180 !! input
9181 <div title="[http://example.com/ link]"></div>
9182 !! result
9183 <div title="&#91;http&#58;//example.com/ link]"></div>
9184
9185 !! end
9186
9187 !! test
9188 Bug 3244: HTML attribute safety (extension; safe)
9189 !! input
9190 <div style="<nowiki>background:blue</nowiki>"></div>
9191 !! result
9192 <div style="background:blue"></div>
9193
9194 !! end
9195
9196 !! test
9197 Bug 3244: HTML attribute safety (extension; unsafe)
9198 !! input
9199 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9200 !! result
9201 <div style="/* insecure input */"></div>
9202
9203 !! end
9204
9205 # More MSIE fun discovered by Tom Gilder
9206
9207 !! test
9208 MSIE CSS safety test: spurious slash
9209 !! input
9210 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9211 !! result
9212 <div style="/* insecure input */">evil</div>
9213
9214 !! end
9215
9216 !! test
9217 MSIE CSS safety test: hex code
9218 !! input
9219 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9220 !! result
9221 <div style="/* insecure input */">evil</div>
9222
9223 !! end
9224
9225 !! test
9226 MSIE CSS safety test: comment in url
9227 !! input
9228 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9229 !! result
9230 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9231
9232 !! end
9233
9234 !! test
9235 MSIE CSS safety test: comment in expression
9236 !! input
9237 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9238 !! result
9239 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9240
9241 !! end
9242
9243
9244 !! test
9245 Table attribute legitimate extension
9246 !! input
9247 {|
9248 !+ style="<nowiki>color:blue</nowiki>"| status
9249 |}
9250 !! result
9251 <table>
9252 <tr>
9253 <th style="color:blue"> status
9254 </th></tr></table>
9255
9256 !!end
9257
9258 !! test
9259 Table attribute safety
9260 !! input
9261 {|
9262 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9263 |}
9264 !! result
9265 <table>
9266 <tr>
9267 <th style="/* insecure input */"> status
9268 </th></tr></table>
9269
9270 !! end
9271
9272 !! test
9273 CSS line continuation 1
9274 !! input
9275 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9276 !! result
9277 <div style="/* insecure input */"></div>
9278
9279 !! end
9280
9281 !! test
9282 CSS line continuation 2
9283 !! input
9284 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9285 !! result
9286 <div style="/* insecure input */"></div>
9287
9288 !! end
9289
9290 !! article
9291 Template:Identity
9292 !! text
9293 {{{1}}}
9294 !! endarticle
9295
9296 !! test
9297 Expansion of multi-line templates in attribute values (bug 6255)
9298 !! input
9299 <div style="background: {{identity|#00FF00}}">-</div>
9300 !! result
9301 <div style="background: #00FF00">-</div>
9302
9303 !! end
9304
9305
9306 !! test
9307 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9308 !! input
9309 <div style="background:
9310 #00FF00">-</div>
9311 !! result
9312 <div style="background: #00FF00">-</div>
9313
9314 !! end
9315
9316 !! test
9317 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9318 !! input
9319 <div style="background: &#10;#00FF00">-</div>
9320 !! result
9321 <div style="background: &#10;#00FF00">-</div>
9322
9323 !! end
9324
9325 ###
9326 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9327 ###
9328 !! test
9329 Parser hook: empty input
9330 !! input
9331 <tag></tag>
9332 !! result
9333 <pre>
9334 ''
9335 array (
9336 )
9337 </pre>
9338
9339 !! end
9340
9341 !! test
9342 Parser hook: empty input using terminated empty elements
9343 !! input
9344 <tag/>
9345 !! result
9346 <pre>
9347 NULL
9348 array (
9349 )
9350 </pre>
9351
9352 !! end
9353
9354 !! test
9355 Parser hook: empty input using terminated empty elements (space before)
9356 !! input
9357 <tag />
9358 !! result
9359 <pre>
9360 NULL
9361 array (
9362 )
9363 </pre>
9364
9365 !! end
9366
9367 !! test
9368 Parser hook: basic input
9369 !! input
9370 <tag>input</tag>
9371 !! result
9372 <pre>
9373 'input'
9374 array (
9375 )
9376 </pre>
9377
9378 !! end
9379
9380
9381 !! test
9382 Parser hook: case insensitive
9383 !! input
9384 <TAG>input</TAG>
9385 !! result
9386 <pre>
9387 'input'
9388 array (
9389 )
9390 </pre>
9391
9392 !! end
9393
9394
9395 !! test
9396 Parser hook: case insensitive, redux
9397 !! input
9398 <TaG>input</TAg>
9399 !! result
9400 <pre>
9401 'input'
9402 array (
9403 )
9404 </pre>
9405
9406 !! end
9407
9408 !! test
9409 Parser hook: nested tags
9410 !! options
9411 noxml
9412 !! input
9413 <tag><tag></tag></tag>
9414 !! result
9415 <pre>
9416 '<tag>'
9417 array (
9418 )
9419 </pre>&lt;/tag&gt;
9420
9421 !! end
9422
9423 !! test
9424 Parser hook: basic arguments
9425 !! input
9426 <tag width=200 height = "100" depth = '50' square></tag>
9427 !! result
9428 <pre>
9429 ''
9430 array (
9431 'width' => '200',
9432 'height' => '100',
9433 'depth' => '50',
9434 'square' => 'square',
9435 )
9436 </pre>
9437
9438 !! end
9439
9440 !! test
9441 Parser hook: argument containing a forward slash (bug 5344)
9442 !! input
9443 <tag filename='/tmp/bla'></tag>
9444 !! result
9445 <pre>
9446 ''
9447 array (
9448 'filename' => '/tmp/bla',
9449 )
9450 </pre>
9451
9452 !! end
9453
9454 !! test
9455 Parser hook: empty input using terminated empty elements (bug 2374)
9456 !! input
9457 <tag foo=bar/>text
9458 !! result
9459 <pre>
9460 NULL
9461 array (
9462 'foo' => 'bar',
9463 )
9464 </pre>text
9465
9466 !! end
9467
9468 # </tag> should be output literally since there is no matching tag that begins it
9469 !! test
9470 Parser hook: basic arguments using terminated empty elements (bug 2374)
9471 !! input
9472 <tag width=200 height = "100" depth = '50' square/>
9473 other stuff
9474 </tag>
9475 !! result
9476 <pre>
9477 NULL
9478 array (
9479 'width' => '200',
9480 'height' => '100',
9481 'depth' => '50',
9482 'square' => 'square',
9483 )
9484 </pre>
9485 <p>other stuff
9486 &lt;/tag&gt;
9487 </p>
9488 !! end
9489
9490 ###
9491 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9492 ###
9493
9494 !! test
9495 Parser hook: static parser hook not inside a comment
9496 !! input
9497 <statictag>hello, world</statictag>
9498 <statictag action=flush/>
9499 !! result
9500 <p>hello, world
9501 </p>
9502 !! end
9503
9504
9505 !! test
9506 Parser hook: static parser hook inside a comment
9507 !! input
9508 <!-- <statictag>hello, world</statictag> -->
9509 <statictag action=flush/>
9510 !! result
9511 <p><br />
9512 </p>
9513 !! end
9514
9515 # Nested template calls; this case was broken by Parser.php rev 1.506,
9516 # since reverted.
9517
9518 !! article
9519 Template:One-parameter
9520 !! text
9521 (My parameter is: {{{1}}})
9522 !! endarticle
9523
9524 !! article
9525 Template:Map-one-parameter
9526 !! text
9527 {{{{{1}}}|{{{2}}}}}
9528 !! endarticle
9529
9530 !! test
9531 Nested template calls
9532 !! input
9533 {{Map-one-parameter|One-parameter|param}}
9534 !! result
9535 <p>(My parameter is: param)
9536 </p>
9537 !! end
9538
9539
9540 ###
9541 ### Sanitizer
9542 ###
9543 !! test
9544 Sanitizer: Closing of open tags
9545 !! input
9546 <s></s><table></table>
9547 !! result
9548 <s></s><table></table>
9549
9550 !! end
9551
9552 !! test
9553 Sanitizer: Closing of open but not closed tags
9554 !! input
9555 <s>foo
9556 !! result
9557 <p><s>foo</s>
9558 </p>
9559 !! end
9560
9561 !! test
9562 Sanitizer: Closing of closed but not open tags
9563 !! input
9564 </s>
9565 !! result
9566 <p>&lt;/s&gt;
9567 </p>
9568 !! end
9569
9570 !! test
9571 Sanitizer: Closing of closed but not open table tags
9572 !! input
9573 Table not started</td></tr></table>
9574 !! result
9575 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9576 </p>
9577 !! end
9578
9579 !! test
9580 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9581 !! input
9582 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9583 !! result
9584 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9585 </p>
9586 !! end
9587
9588 !! test
9589 Sanitizer: Validating the contents of the id attribute (bug 4515)
9590 !! options
9591 disabled
9592 !! input
9593 <br id=9 />
9594 !! result
9595 Something, but definitely not <br id="9" />...
9596 !! end
9597
9598 !! test
9599 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9600 !! options
9601 disabled
9602 !! input
9603 <br id="foo" /><br id="foo" />
9604 !! result
9605 Something need to be done. foo-2 ?
9606 !! end
9607
9608 !! test
9609 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9610 !! input
9611 <div itemscope>
9612 <meta itemprop="hello" content="world">
9613 <meta http-equiv="refresh" content="5">
9614 <meta itemprop="hello" http-equiv="refresh" content="5">
9615 <link itemprop="hello" href="{{SERVER}}">
9616 <link rel="stylesheet" href="{{SERVER}}">
9617 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9618 </div>
9619 !! result
9620 <div itemscope="itemscope">
9621 <p> <meta itemprop="hello" content="world" />
9622 &lt;meta http-equiv="refresh" content="5"&gt;
9623 <meta itemprop="hello" content="5" />
9624 </p>
9625 <link itemprop="hello" href="http&#58;//example.org" />
9626 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9627 <link itemprop="hello" href="http&#58;//example.org" />
9628 </div>
9629
9630 !! end
9631
9632 !! test
9633 Language converter: output gets cut off unexpectedly (bug 5757)
9634 !! options
9635 language=zh
9636 !! input
9637 this bit is safe: }-
9638
9639 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9640
9641 then we get cut off here: }-
9642
9643 all additional text is vanished
9644 !! result
9645 <p>this bit is safe: }-
9646 </p><p>but if we add a conversion instance: xxx
9647 </p><p>then we get cut off here: }-
9648 </p><p>all additional text is vanished
9649 </p>
9650 !! end
9651
9652 !! test
9653 Self closed html pairs (bug 5487)
9654 !! options
9655 !! input
9656 <center><font id="bug" />Centered text</center>
9657 <div><font id="bug2" />In div text</div>
9658 !! result
9659 <center>&lt;font id="bug" /&gt;Centered text</center>
9660 <div>&lt;font id="bug2" /&gt;In div text</div>
9661
9662 !! end
9663
9664 #
9665 #
9666 #
9667
9668 !! test
9669 Punctuation: nbsp before exclamation
9670 !! input
9671 C'est grave !
9672 !! result
9673 <p>C'est grave&#160;!
9674 </p>
9675 !! end
9676
9677 !! test
9678 Punctuation: CSS !important (bug 11874)
9679 !! input
9680 <div style="width:50% !important">important</div>
9681 !! result
9682 <div style="width:50% !important">important</div>
9683
9684 !!end
9685
9686 !! test
9687 Punctuation: CSS ! important (bug 11874; with space after)
9688 !! input
9689 <div style="width:50% ! important">important</div>
9690 !! result
9691 <div style="width:50% ! important">important</div>
9692
9693 !!end
9694
9695
9696 !! test
9697 HTML bullet list, closed tags (bug 5497)
9698 !! input
9699 <ul>
9700 <li>One</li>
9701 <li>Two</li>
9702 </ul>
9703 !! result
9704 <ul>
9705 <li>One</li>
9706 <li>Two</li>
9707 </ul>
9708
9709 !! end
9710
9711 !! test
9712 HTML bullet list, unclosed tags (bug 5497)
9713 !! options
9714 disabled
9715 !! input
9716 <ul>
9717 <li>One
9718 <li>Two
9719 </ul>
9720 !! result
9721 <ul>
9722 <li>One
9723 </li><li>Two
9724 </li></ul>
9725
9726 !! end
9727
9728 !! test
9729 HTML ordered list, closed tags (bug 5497)
9730 !! input
9731 <ol>
9732 <li>One</li>
9733 <li>Two</li>
9734 </ol>
9735 !! result
9736 <ol>
9737 <li>One</li>
9738 <li>Two</li>
9739 </ol>
9740
9741 !! end
9742
9743 !! test
9744 HTML ordered list, unclosed tags (bug 5497)
9745 !! options
9746 disabled
9747 !! input
9748 <ol>
9749 <li>One
9750 <li>Two
9751 </ol>
9752 !! result
9753 <ol>
9754 <li>One
9755 </li><li>Two
9756 </li></ol>
9757
9758 !! end
9759
9760 !! test
9761 HTML nested bullet list, closed tags (bug 5497)
9762 !! input
9763 <ul>
9764 <li>One</li>
9765 <li>Two:
9766 <ul>
9767 <li>Sub-one</li>
9768 <li>Sub-two</li>
9769 </ul>
9770 </li>
9771 </ul>
9772 !! result
9773 <ul>
9774 <li>One</li>
9775 <li>Two:
9776 <ul>
9777 <li>Sub-one</li>
9778 <li>Sub-two</li>
9779 </ul>
9780 </li>
9781 </ul>
9782
9783 !! end
9784
9785 !! test
9786 HTML nested bullet list, open tags (bug 5497)
9787 !! options
9788 disabled
9789 !! input
9790 <ul>
9791 <li>One
9792 <li>Two:
9793 <ul>
9794 <li>Sub-one
9795 <li>Sub-two
9796 </ul>
9797 </ul>
9798 !! result
9799 <ul>
9800 <li>One
9801 </li><li>Two:
9802 <ul>
9803 <li>Sub-one
9804 </li><li>Sub-two
9805 </li></ul>
9806 </li></ul>
9807
9808 !! end
9809
9810 !! test
9811 HTML nested ordered list, closed tags (bug 5497)
9812 !! input
9813 <ol>
9814 <li>One</li>
9815 <li>Two:
9816 <ol>
9817 <li>Sub-one</li>
9818 <li>Sub-two</li>
9819 </ol>
9820 </li>
9821 </ol>
9822 !! result
9823 <ol>
9824 <li>One</li>
9825 <li>Two:
9826 <ol>
9827 <li>Sub-one</li>
9828 <li>Sub-two</li>
9829 </ol>
9830 </li>
9831 </ol>
9832
9833 !! end
9834
9835 !! test
9836 HTML nested ordered list, open tags (bug 5497)
9837 !! options
9838 disabled
9839 !! input
9840 <ol>
9841 <li>One
9842 <li>Two:
9843 <ol>
9844 <li>Sub-one
9845 <li>Sub-two
9846 </ol>
9847 </ol>
9848 !! result
9849 <ol>
9850 <li>One
9851 </li><li>Two:
9852 <ol>
9853 <li>Sub-one
9854 </li><li>Sub-two
9855 </li></ol>
9856 </li></ol>
9857
9858 !! end
9859
9860 !! test
9861 HTML ordered list item with parameters oddity
9862 !! input
9863 <ol><li id="fragment">One</li></ol>
9864 !! result
9865 <ol><li id="fragment">One</li></ol>
9866
9867 !! end
9868
9869 !!test
9870 bug 5918: autonumbering
9871 !! input
9872 [http://first/] [http://second] [ftp://ftp]
9873
9874 ftp://inlineftp
9875
9876 [mailto:enclosed@mail.tld With target]
9877
9878 [mailto:enclosed@mail.tld]
9879
9880 mailto:inline@mail.tld
9881 !! result
9882 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
9883 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9884 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9885 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9886 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9887 </p>
9888 !! end
9889
9890
9891 #
9892 # Security and HTML correctness
9893 # From Nick Jenkins' fuzz testing
9894 #
9895
9896 !! test
9897 Fuzz testing: Parser13
9898 !! input
9899 {|
9900 | http://a|
9901 !! result
9902 <table>
9903 <tr>
9904 <td>
9905 </td>
9906 </tr>
9907 </table>
9908
9909 !! end
9910
9911 !! test
9912 Fuzz testing: Parser14
9913 !! input
9914 == onmouseover= ==
9915 http://__TOC__
9916 !! result
9917 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span></h2>
9918 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9919 <ul>
9920 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9921 </ul>
9922 </td></tr></table>
9923
9924 !! end
9925
9926 !! test
9927 Fuzz testing: Parser14-table
9928 !! input
9929 ==a==
9930 {| STYLE=__TOC__
9931 !! result
9932 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span></h2>
9933 <table style="&#95;_TOC&#95;_">
9934 <tr><td></td></tr>
9935 </table>
9936
9937 !! end
9938
9939 # Known to produce bogus xml (extra </td>)
9940 !! test
9941 Fuzz testing: Parser16
9942 !! options
9943 noxml
9944 !! input
9945 {|
9946 !https://||||||
9947 !! result
9948 <table>
9949 <tr>
9950 <th>https://</th>
9951 <th></th>
9952 <th></th>
9953 <th>
9954 </td>
9955 </tr>
9956 </table>
9957
9958 !! end
9959
9960 !! test
9961 Fuzz testing: Parser21
9962 !! input
9963 {|
9964 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9965 |
9966 !! result
9967 <table>
9968 <tr>
9969 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9970 </th>
9971 <td>
9972 </td>
9973 </tr>
9974 </table>
9975
9976 !! end
9977
9978 !! test
9979 Fuzz testing: Parser22
9980 !! input
9981 http://===r:::https://b
9982
9983 {|
9984 !!result
9985 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9986 </p>
9987 <table>
9988 <tr><td></td></tr>
9989 </table>
9990
9991 !! end
9992
9993 # Known to produce bad XML for now
9994 !! test
9995 Fuzz testing: Parser24
9996 !! options
9997 noxml
9998 !! input
9999 {|
10000 {{{|
10001 <u CLASS=
10002 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10003 <br style="onmouseover='alert(document.cookie);' " />
10004
10005 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10006 |
10007 !! result
10008 <table>
10009 {{{|
10010 <u class="&#124;">}}}} &gt;
10011 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10012
10013 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10014 <tr>
10015 <td></u>
10016 </td>
10017 </tr>
10018 </table>
10019
10020 !! end
10021
10022 # Note: the current result listed for this is not what the original one was,
10023 # but the original bug was JavaScript injection, which is fixed in any case.
10024 # It's not clear that the original result listed was any more correct than the
10025 # current one. Original result:
10026 # <p>{{{|
10027 # </p>
10028 # <li class="&#124;&#124;">
10029 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10030 !!test
10031 Fuzz testing: Parser25 (bug 6055)
10032 !! input
10033 {{{
10034 |
10035 <LI CLASS=||
10036 >
10037 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10038 !! result
10039 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10040 </p>
10041 !! end
10042
10043 !!test
10044 Fuzz testing: URL adjacent extension (with space, clean)
10045 !! options
10046 !! input
10047 http://example.com <nowiki>junk</nowiki>
10048 !! result
10049 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10050 </p>
10051 !!end
10052
10053 !!test
10054 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10055 !! options
10056 !! input
10057 http://example.com<nowiki>junk</nowiki>
10058 !! result
10059 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10060 </p>
10061 !!end
10062
10063 !!test
10064 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10065 !! options
10066 !! input
10067 http://example.com<pre>junk</pre>
10068 !! result
10069 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10070
10071 !!end
10072
10073 !!test
10074 Fuzz testing: image with bogus manual thumbnail
10075 !!input
10076 [[Image:foobar.jpg|thumbnail= ]]
10077 !!result
10078 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10079
10080 !!end
10081
10082 !! test
10083 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10084 !! input
10085 <pre dir="&#10;"></pre>
10086 !! result
10087 <pre dir="&#10;"></pre>
10088
10089 !! end
10090
10091 !! test
10092 Parsing optional HTML elements (Bug 6171)
10093 !! options
10094 !! input
10095 <table>
10096 <tr>
10097 <td> Some tabular data</td>
10098 <td> More tabular data ...
10099 <td> And yet som tabular data</td>
10100 </tr>
10101 </table>
10102 !! result
10103 <table>
10104 <tr>
10105 <td> Some tabular data</td>
10106 <td> More tabular data ...
10107 </td><td> And yet som tabular data</td>
10108 </tr>
10109 </table>
10110
10111 !! end
10112
10113 !! test
10114 Correct handling of <td>, <tr> (Bug 6171)
10115 !! options
10116 !! input
10117 <table>
10118 <tr>
10119 <td> Some tabular data</td>
10120 <td> More tabular data ...</td>
10121 <td> And yet som tabular data</td>
10122 </tr>
10123 </table>
10124 !! result
10125 <table>
10126 <tr>
10127 <td> Some tabular data</td>
10128 <td> More tabular data ...</td>
10129 <td> And yet som tabular data</td>
10130 </tr>
10131 </table>
10132
10133 !! end
10134
10135
10136 !! test
10137 Parsing crashing regression (fr:JavaScript)
10138 !! input
10139 </body></x>
10140 !! result
10141 <p>&lt;/body&gt;&lt;/x&gt;
10142 </p>
10143 !! end
10144
10145 !! test
10146 Inline wiki vs wiki block nesting
10147 !! input
10148 '''Bold paragraph
10149
10150 New wiki paragraph
10151 !! result
10152 <p><b>Bold paragraph</b>
10153 </p><p>New wiki paragraph
10154 </p>
10155 !! end
10156
10157 !! test
10158 Inline HTML vs wiki block nesting
10159 !! options
10160 disabled
10161 !! input
10162 <b>Bold paragraph
10163
10164 New wiki paragraph
10165 !! result
10166 <p><b>Bold paragraph</b>
10167 </p><p>New wiki paragraph
10168 </p>
10169 !! end
10170
10171 # Original result was this:
10172 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10173 # </p>
10174 # While that might be marginally more intuitive, maybe, the six-apostrophe
10175 # construct is clearly pathological and the result stated here (which is what
10176 # the parser actually does) is about as reasonable as anything.
10177 !!test
10178 Mixing markup for italics and bold
10179 !! options
10180 !! input
10181 '''bold''''''bold''bolditalics'''''
10182 !! result
10183 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10184 </p>
10185 !! end
10186
10187
10188 !! article
10189 Xyzzyx
10190 !! text
10191 Article for special page transclusion test
10192 !! endarticle
10193
10194 !! test
10195 Special page transclusion
10196 !! options
10197 !! input
10198 {{Special:Prefixindex/Xyzzyx}}
10199 !! result
10200 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10201
10202 !! end
10203
10204 !! test
10205 Special page transclusion twice (bug 5021)
10206 !! options
10207 !! input
10208 {{Special:Prefixindex/Xyzzyx}}
10209 {{Special:Prefixindex/Xyzzyx}}
10210 !! result
10211 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10212 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10213
10214 !! end
10215
10216 !! test
10217 Transclusion of default MediaWiki message
10218 !! input
10219 {{MediaWiki:Mainpage}}
10220 !!result
10221 <p>Main Page
10222 </p>
10223 !! end
10224
10225 !! test
10226 Transclusion of nonexistent MediaWiki message
10227 !! input
10228 {{MediaWiki:Mainpagexxx}}
10229 !!result
10230 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
10231 </p>
10232 !! end
10233
10234 !! test
10235 Transclusion of MediaWiki message with underscore
10236 !! input
10237 {{MediaWiki:history_short}}
10238 !! result
10239 <p>History
10240 </p>
10241 !! end
10242
10243 !! test
10244 Transclusion of MediaWiki message with space
10245 !! input
10246 {{MediaWiki:history short}}
10247 !! result
10248 <p>History
10249 </p>
10250 !! end
10251
10252 !! test
10253 Invalid header with following text
10254 !! input
10255 = x = y
10256 !! result
10257 <p>= x = y
10258 </p>
10259 !! end
10260
10261
10262 !! test
10263 Section extraction test (section 0)
10264 !! options
10265 section=0
10266 !! input
10267 start
10268 ==a==
10269 ===aa===
10270 ====aaa====
10271 ==b==
10272 ===ba===
10273 ===bb===
10274 ====bba====
10275 ===bc===
10276 ==c==
10277 ===ca===
10278 !! result
10279 start
10280 !! end
10281
10282 !! test
10283 Section extraction test (section 1)
10284 !! options
10285 section=1
10286 !! input
10287 start
10288 ==a==
10289 ===aa===
10290 ====aaa====
10291 ==b==
10292 ===ba===
10293 ===bb===
10294 ====bba====
10295 ===bc===
10296 ==c==
10297 ===ca===
10298 !! result
10299 ==a==
10300 ===aa===
10301 ====aaa====
10302 !! end
10303
10304 !! test
10305 Section extraction test (section 2)
10306 !! options
10307 section=2
10308 !! input
10309 start
10310 ==a==
10311 ===aa===
10312 ====aaa====
10313 ==b==
10314 ===ba===
10315 ===bb===
10316 ====bba====
10317 ===bc===
10318 ==c==
10319 ===ca===
10320 !! result
10321 ===aa===
10322 ====aaa====
10323 !! end
10324
10325 !! test
10326 Section extraction test (section 3)
10327 !! options
10328 section=3
10329 !! input
10330 start
10331 ==a==
10332 ===aa===
10333 ====aaa====
10334 ==b==
10335 ===ba===
10336 ===bb===
10337 ====bba====
10338 ===bc===
10339 ==c==
10340 ===ca===
10341 !! result
10342 ====aaa====
10343 !! end
10344
10345 !! test
10346 Section extraction test (section 4)
10347 !! options
10348 section=4
10349 !! input
10350 start
10351 ==a==
10352 ===aa===
10353 ====aaa====
10354 ==b==
10355 ===ba===
10356 ===bb===
10357 ====bba====
10358 ===bc===
10359 ==c==
10360 ===ca===
10361 !! result
10362 ==b==
10363 ===ba===
10364 ===bb===
10365 ====bba====
10366 ===bc===
10367 !! end
10368
10369 !! test
10370 Section extraction test (section 5)
10371 !! options
10372 section=5
10373 !! input
10374 start
10375 ==a==
10376 ===aa===
10377 ====aaa====
10378 ==b==
10379 ===ba===
10380 ===bb===
10381 ====bba====
10382 ===bc===
10383 ==c==
10384 ===ca===
10385 !! result
10386 ===ba===
10387 !! end
10388
10389 !! test
10390 Section extraction test (section 6)
10391 !! options
10392 section=6
10393 !! input
10394 start
10395 ==a==
10396 ===aa===
10397 ====aaa====
10398 ==b==
10399 ===ba===
10400 ===bb===
10401 ====bba====
10402 ===bc===
10403 ==c==
10404 ===ca===
10405 !! result
10406 ===bb===
10407 ====bba====
10408 !! end
10409
10410 !! test
10411 Section extraction test (section 7)
10412 !! options
10413 section=7
10414 !! input
10415 start
10416 ==a==
10417 ===aa===
10418 ====aaa====
10419 ==b==
10420 ===ba===
10421 ===bb===
10422 ====bba====
10423 ===bc===
10424 ==c==
10425 ===ca===
10426 !! result
10427 ====bba====
10428 !! end
10429
10430 !! test
10431 Section extraction test (section 8)
10432 !! options
10433 section=8
10434 !! input
10435 start
10436 ==a==
10437 ===aa===
10438 ====aaa====
10439 ==b==
10440 ===ba===
10441 ===bb===
10442 ====bba====
10443 ===bc===
10444 ==c==
10445 ===ca===
10446 !! result
10447 ===bc===
10448 !! end
10449
10450 !! test
10451 Section extraction test (section 9)
10452 !! options
10453 section=9
10454 !! input
10455 start
10456 ==a==
10457 ===aa===
10458 ====aaa====
10459 ==b==
10460 ===ba===
10461 ===bb===
10462 ====bba====
10463 ===bc===
10464 ==c==
10465 ===ca===
10466 !! result
10467 ==c==
10468 ===ca===
10469 !! end
10470
10471 !! test
10472 Section extraction test (section 10)
10473 !! options
10474 section=10
10475 !! input
10476 start
10477 ==a==
10478 ===aa===
10479 ====aaa====
10480 ==b==
10481 ===ba===
10482 ===bb===
10483 ====bba====
10484 ===bc===
10485 ==c==
10486 ===ca===
10487 !! result
10488 ===ca===
10489 !! end
10490
10491 !! test
10492 Section extraction test (nonexistent section 11)
10493 !! options
10494 section=11
10495 !! input
10496 start
10497 ==a==
10498 ===aa===
10499 ====aaa====
10500 ==b==
10501 ===ba===
10502 ===bb===
10503 ====bba====
10504 ===bc===
10505 ==c==
10506 ===ca===
10507 !! result
10508 !! end
10509
10510 !! test
10511 Section extraction test with bogus heading (section 1)
10512 !! options
10513 section=1
10514 !! input
10515 ==a==
10516 ==bogus== not a legal section
10517 ==b==
10518 !! result
10519 ==a==
10520 ==bogus== not a legal section
10521 !! end
10522
10523 !! test
10524 Section extraction test with bogus heading (section 2)
10525 !! options
10526 section=2
10527 !! input
10528 ==a==
10529 ==bogus== not a legal section
10530 ==b==
10531 !! result
10532 ==b==
10533 !! end
10534
10535 !! test
10536 Section extraction test with comment after heading (section 1)
10537 !! options
10538 section=1
10539 !! input
10540 ==a==
10541 ==b== <!-- -->
10542 ==c==
10543 !! result
10544 ==a==
10545 !! end
10546
10547 !! test
10548 Section extraction test with comment after heading (section 2)
10549 !! options
10550 section=2
10551 !! input
10552 ==a==
10553 ==b== <!-- -->
10554 ==c==
10555 !! result
10556 ==b== <!-- -->
10557 !! end
10558
10559 !! test
10560 Section extraction test with bogus <nowiki> heading (section 1)
10561 !! options
10562 section=1
10563 !! input
10564 ==a==
10565 ==bogus== <nowiki>not a legal section</nowiki>
10566 ==b==
10567 !! result
10568 ==a==
10569 ==bogus== <nowiki>not a legal section</nowiki>
10570 !! end
10571
10572 !! test
10573 Section extraction test with bogus <nowiki> heading (section 2)
10574 !! options
10575 section=2
10576 !! input
10577 ==a==
10578 ==bogus== <nowiki>not a legal section</nowiki>
10579 ==b==
10580 !! result
10581 ==b==
10582 !! end
10583
10584
10585 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10586 # instead of respecting commented sections
10587 !! test
10588 Section extraction prefixed by comment (section 1)
10589 !! options
10590 section=1
10591 !! input
10592 <!-- -->==sec1==
10593 ==sec2==
10594 !!result
10595 ==sec2==
10596 !!end
10597
10598 !! test
10599 Section extraction prefixed by comment (section 2)
10600 !! options
10601 section=2
10602 !! input
10603 <!-- -->==sec1==
10604 ==sec2==
10605 !!result
10606
10607 !!end
10608
10609
10610 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10611 # instead of respecting HTML-style headings
10612 !! test
10613 Section extraction, mixed wiki and html (section 1)
10614 !! options
10615 section=1
10616 !! input
10617 <h2>unmarked</h2>
10618 unmarked
10619 ==1==
10620 one
10621 ==2==
10622 two
10623 !! result
10624 ==1==
10625 one
10626 !! end
10627
10628 !! test
10629 Section extraction, mixed wiki and html (section 2)
10630 !! options
10631 section=2
10632 !! input
10633 <h2>unmarked</h2>
10634 unmarked
10635 ==1==
10636 one
10637 ==2==
10638 two
10639 !! result
10640 ==2==
10641 two
10642 !! end
10643
10644
10645 # Formerly testing for bug 3342
10646 !! test
10647 Section extraction, heading surrounded by <noinclude>
10648 !! options
10649 section=1
10650 !! input
10651 <noinclude>==unmarked==</noinclude>
10652 ==marked==
10653 !! result
10654 ==marked==
10655 !!end
10656
10657 # Test behavior of bug 19910
10658 !! test
10659 Sectiion with all-equals
10660 !! options
10661 section=2
10662 !! input
10663 ===
10664 The line above must have a trailing space
10665 === <!--
10666 --> <!-- -->
10667 But just in case it doesn't...
10668 !! result
10669 === <!--
10670 --> <!-- -->
10671 But just in case it doesn't...
10672 !! end
10673
10674 !! test
10675 Section replacement test (section 0)
10676 !! options
10677 replace=0,"xxx"
10678 !! input
10679 start
10680 ==a==
10681 ===aa===
10682 ====aaa====
10683 ==b==
10684 ===ba===
10685 ===bb===
10686 ====bba====
10687 ===bc===
10688 ==c==
10689 ===ca===
10690 !! result
10691 xxx
10692
10693 ==a==
10694 ===aa===
10695 ====aaa====
10696 ==b==
10697 ===ba===
10698 ===bb===
10699 ====bba====
10700 ===bc===
10701 ==c==
10702 ===ca===
10703 !! end
10704
10705 !! test
10706 Section replacement test (section 1)
10707 !! options
10708 replace=1,"xxx"
10709 !! input
10710 start
10711 ==a==
10712 ===aa===
10713 ====aaa====
10714 ==b==
10715 ===ba===
10716 ===bb===
10717 ====bba====
10718 ===bc===
10719 ==c==
10720 ===ca===
10721 !! result
10722 start
10723 xxx
10724
10725 ==b==
10726 ===ba===
10727 ===bb===
10728 ====bba====
10729 ===bc===
10730 ==c==
10731 ===ca===
10732 !! end
10733
10734 !! test
10735 Section replacement test (section 2)
10736 !! options
10737 replace=2,"xxx"
10738 !! input
10739 start
10740 ==a==
10741 ===aa===
10742 ====aaa====
10743 ==b==
10744 ===ba===
10745 ===bb===
10746 ====bba====
10747 ===bc===
10748 ==c==
10749 ===ca===
10750 !! result
10751 start
10752 ==a==
10753 xxx
10754
10755 ==b==
10756 ===ba===
10757 ===bb===
10758 ====bba====
10759 ===bc===
10760 ==c==
10761 ===ca===
10762 !! end
10763
10764 !! test
10765 Section replacement test (section 3)
10766 !! options
10767 replace=3,"xxx"
10768 !! input
10769 start
10770 ==a==
10771 ===aa===
10772 ====aaa====
10773 ==b==
10774 ===ba===
10775 ===bb===
10776 ====bba====
10777 ===bc===
10778 ==c==
10779 ===ca===
10780 !! result
10781 start
10782 ==a==
10783 ===aa===
10784 xxx
10785
10786 ==b==
10787 ===ba===
10788 ===bb===
10789 ====bba====
10790 ===bc===
10791 ==c==
10792 ===ca===
10793 !! end
10794
10795 !! test
10796 Section replacement test (section 4)
10797 !! options
10798 replace=4,"xxx"
10799 !! input
10800 start
10801 ==a==
10802 ===aa===
10803 ====aaa====
10804 ==b==
10805 ===ba===
10806 ===bb===
10807 ====bba====
10808 ===bc===
10809 ==c==
10810 ===ca===
10811 !! result
10812 start
10813 ==a==
10814 ===aa===
10815 ====aaa====
10816 xxx
10817
10818 ==c==
10819 ===ca===
10820 !! end
10821
10822 !! test
10823 Section replacement test (section 5)
10824 !! options
10825 replace=5,"xxx"
10826 !! input
10827 start
10828 ==a==
10829 ===aa===
10830 ====aaa====
10831 ==b==
10832 ===ba===
10833 ===bb===
10834 ====bba====
10835 ===bc===
10836 ==c==
10837 ===ca===
10838 !! result
10839 start
10840 ==a==
10841 ===aa===
10842 ====aaa====
10843 ==b==
10844 xxx
10845
10846 ===bb===
10847 ====bba====
10848 ===bc===
10849 ==c==
10850 ===ca===
10851 !! end
10852
10853 !! test
10854 Section replacement test (section 6)
10855 !! options
10856 replace=6,"xxx"
10857 !! input
10858 start
10859 ==a==
10860 ===aa===
10861 ====aaa====
10862 ==b==
10863 ===ba===
10864 ===bb===
10865 ====bba====
10866 ===bc===
10867 ==c==
10868 ===ca===
10869 !! result
10870 start
10871 ==a==
10872 ===aa===
10873 ====aaa====
10874 ==b==
10875 ===ba===
10876 xxx
10877
10878 ===bc===
10879 ==c==
10880 ===ca===
10881 !! end
10882
10883 !! test
10884 Section replacement test (section 7)
10885 !! options
10886 replace=7,"xxx"
10887 !! input
10888 start
10889 ==a==
10890 ===aa===
10891 ====aaa====
10892 ==b==
10893 ===ba===
10894 ===bb===
10895 ====bba====
10896 ===bc===
10897 ==c==
10898 ===ca===
10899 !! result
10900 start
10901 ==a==
10902 ===aa===
10903 ====aaa====
10904 ==b==
10905 ===ba===
10906 ===bb===
10907 xxx
10908
10909 ===bc===
10910 ==c==
10911 ===ca===
10912 !! end
10913
10914 !! test
10915 Section replacement test (section 8)
10916 !! options
10917 replace=8,"xxx"
10918 !! input
10919 start
10920 ==a==
10921 ===aa===
10922 ====aaa====
10923 ==b==
10924 ===ba===
10925 ===bb===
10926 ====bba====
10927 ===bc===
10928 ==c==
10929 ===ca===
10930 !! result
10931 start
10932 ==a==
10933 ===aa===
10934 ====aaa====
10935 ==b==
10936 ===ba===
10937 ===bb===
10938 ====bba====
10939 xxx
10940
10941 ==c==
10942 ===ca===
10943 !!end
10944
10945 !! test
10946 Section replacement test (section 9)
10947 !! options
10948 replace=9,"xxx"
10949 !! input
10950 start
10951 ==a==
10952 ===aa===
10953 ====aaa====
10954 ==b==
10955 ===ba===
10956 ===bb===
10957 ====bba====
10958 ===bc===
10959 ==c==
10960 ===ca===
10961 !! result
10962 start
10963 ==a==
10964 ===aa===
10965 ====aaa====
10966 ==b==
10967 ===ba===
10968 ===bb===
10969 ====bba====
10970 ===bc===
10971 xxx
10972 !! end
10973
10974 !! test
10975 Section replacement test (section 10)
10976 !! options
10977 replace=10,"xxx"
10978 !! input
10979 start
10980 ==a==
10981 ===aa===
10982 ====aaa====
10983 ==b==
10984 ===ba===
10985 ===bb===
10986 ====bba====
10987 ===bc===
10988 ==c==
10989 ===ca===
10990 !! result
10991 start
10992 ==a==
10993 ===aa===
10994 ====aaa====
10995 ==b==
10996 ===ba===
10997 ===bb===
10998 ====bba====
10999 ===bc===
11000 ==c==
11001 xxx
11002 !! end
11003
11004 !! test
11005 Section replacement test with initial whitespace (bug 13728)
11006 !! options
11007 replace=2,"xxx"
11008 !! input
11009 Preformatted initial line
11010 ==a==
11011 ===a===
11012 !! result
11013 Preformatted initial line
11014 ==a==
11015 xxx
11016 !! end
11017
11018
11019 !! test
11020 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11021 !! options
11022 section=1
11023 !! input
11024 ==a==
11025 a
11026 !! result
11027 ==a==
11028 a
11029 !! end
11030
11031 !! test
11032 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11033 !! options
11034 section=1
11035 !! input
11036 ==a==
11037 a
11038 !! result
11039 ==a==
11040 a
11041 !! end
11042
11043
11044 !! test
11045 Section extraction, <pre> around bogus header (bug 10309)
11046 !! options
11047 noxml section=2
11048 !! input
11049 == Section One ==
11050 <pre>
11051 =======
11052 </pre>
11053
11054 == Section Two ==
11055 stuff
11056 !! result
11057 == Section Two ==
11058 stuff
11059 !! end
11060
11061 !! test
11062 Section replacement, <pre> around bogus header (bug 10309)
11063 !! options
11064 noxml replace=2,"xxx"
11065 !! input
11066 == Section One ==
11067 <pre>
11068 =======
11069 </pre>
11070
11071 == Section Two ==
11072 stuff
11073 !! result
11074 == Section One ==
11075 <pre>
11076 =======
11077 </pre>
11078
11079 xxx
11080 !! end
11081
11082
11083
11084 !! test
11085 Handling of &#x0A; in URLs
11086 !! input
11087 **irc://&#x0A;a
11088 !! result
11089 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11090 </li></ul>
11091 </li></ul>
11092
11093 !!end
11094
11095 !! test
11096 5 quotes, code coverage +1 line (php)
11097 !! options
11098 php
11099 !! input
11100 '''''
11101 !! result
11102 !! end
11103 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11104 !! test
11105 5 quotes, code coverage +1 line (parsoid)
11106 !! options
11107 parsoid
11108 !! input
11109 '''''
11110 !! result
11111 <p><i><b></b></i></p>
11112 !! end
11113
11114 !! test
11115 Special:Search page linking.
11116 !! input
11117 {{Special:search}}
11118 !! result
11119 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11120 </p>
11121 !! end
11122
11123 !! test
11124 Say the magic word
11125 !! input
11126 * {{PAGENAME}}
11127 * {{BASEPAGENAME}}
11128 * {{SUBPAGENAME}}
11129 * {{SUBPAGENAMEE}}
11130 * {{ROOTPAGENAME}}
11131 * {{ROOTPAGENAMEE}}
11132 * {{BASEPAGENAME}}
11133 * {{BASEPAGENAMEE}}
11134 * {{TALKPAGENAME}}
11135 * {{TALKPAGENAMEE}}
11136 * {{SUBJECTPAGENAME}}
11137 * {{SUBJECTPAGENAMEE}}
11138 * {{NAMESPACEE}}
11139 * {{NAMESPACE}}
11140 * {{TALKSPACE}}
11141 * {{TALKSPACEE}}
11142 * {{SUBJECTSPACE}}
11143 * {{SUBJECTSPACEE}}
11144 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11145 !! result
11146 <ul><li> Parser test
11147 </li><li> Parser test
11148 </li><li> Parser test
11149 </li><li> Parser_test
11150 </li><li> Parser test
11151 </li><li> Parser_test
11152 </li><li> Parser test
11153 </li><li> Parser_test
11154 </li><li> Talk:Parser test
11155 </li><li> Talk:Parser_test
11156 </li><li> Parser test
11157 </li><li> Parser_test
11158 </li><li>
11159 </li><li>
11160 </li><li> Talk
11161 </li><li> Talk
11162 </li><li>
11163 </li><li>
11164 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
11165 </li></ul>
11166
11167 !! end
11168 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11169
11170 !! test
11171 Gallery
11172 !! input
11173 <gallery>
11174 image1.png |
11175 image2.gif|||||
11176
11177 image3|
11178 image4 |300px| centre
11179 image5.svg| http://///////
11180 [[x|xx]]]]
11181 * image6
11182 </gallery>
11183 !! result
11184 <ul class="gallery">
11185 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11186 <div style="height: 150px;">Image1.png</div>
11187 <div class="gallerytext">
11188 </div>
11189 </div></li>
11190 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11191 <div style="height: 150px;">Image2.gif</div>
11192 <div class="gallerytext">
11193 <p>||||
11194 </p>
11195 </div>
11196 </div></li>
11197 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11198 <div style="height: 150px;">Image3</div>
11199 <div class="gallerytext">
11200 </div>
11201 </div></li>
11202 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11203 <div style="height: 150px;">Image4</div>
11204 <div class="gallerytext">
11205 <p>300px| centre
11206 </p>
11207 </div>
11208 </div></li>
11209 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11210 <div style="height: 150px;">Image5.svg</div>
11211 <div class="gallerytext">
11212 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11213 </p>
11214 </div>
11215 </div></li>
11216 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11217 <div style="height: 150px;">* image6</div>
11218 <div class="gallerytext">
11219 </div>
11220 </div></li>
11221 </ul>
11222
11223 !! end
11224
11225 !! test
11226 Gallery (with options)
11227 !! input
11228 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11229 File:Nonexistant.jpg|caption
11230 File:Nonexistant.jpg
11231 image:foobar.jpg|some '''caption''' [[Main Page]]
11232 image:foobar.jpg
11233 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11234 </gallery>
11235 !! result
11236 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11237 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11238 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11239 <div style="height: 70px;">Nonexistant.jpg</div>
11240 <div class="gallerytext">
11241 <p>caption
11242 </p>
11243 </div>
11244 </div></li>
11245 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11246 <div style="height: 70px;">Nonexistant.jpg</div>
11247 <div class="gallerytext">
11248 </div>
11249 </div></li>
11250 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11251 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11252 <div class="gallerytext">
11253 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11254 </p>
11255 </div>
11256 </div></li>
11257 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11258 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11259 <div class="gallerytext">
11260 </div>
11261 </div></li>
11262 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11263 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11264 <div class="gallerytext">
11265 <p>Blabla|blabla.
11266 </p>
11267 </div>
11268 </div></li>
11269 </ul>
11270
11271 !! end
11272
11273 !! test
11274 Gallery with wikitext inside caption
11275 !! input
11276 <gallery>
11277 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11278 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11279 </gallery>
11280 !! result
11281 <ul class="gallery">
11282 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11283 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11284 <div class="gallerytext">
11285 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
11286 </p>
11287 </div>
11288 </div></li>
11289 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11290 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11291 <div class="gallerytext">
11292 <p>This is a test template
11293 </p>
11294 </div>
11295 </div></li>
11296 </ul>
11297
11298 !! end
11299
11300 !! test
11301 gallery (with showfilename option)
11302 !! input
11303 <gallery showfilename>
11304 File:Nonexistant.jpg|caption
11305 File:Nonexistant.jpg
11306 image:foobar.jpg|some '''caption''' [[Main Page]]
11307 File:Foobar.jpg
11308 </gallery>
11309 !! result
11310 <ul class="gallery">
11311 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11312 <div style="height: 150px;">Nonexistant.jpg</div>
11313 <div class="gallerytext">
11314 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11315 caption
11316 </p>
11317 </div>
11318 </div></li>
11319 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11320 <div style="height: 150px;">Nonexistant.jpg</div>
11321 <div class="gallerytext">
11322 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11323 </p>
11324 </div>
11325 </div></li>
11326 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11327 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11328 <div class="gallerytext">
11329 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11330 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11331 </p>
11332 </div>
11333 </div></li>
11334 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11335 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11336 <div class="gallerytext">
11337 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11338 </p>
11339 </div>
11340 </div></li>
11341 </ul>
11342
11343 !! end
11344
11345 !! test
11346 Gallery (with namespace-less filenames)
11347 !! input
11348 <gallery>
11349 File:Nonexistant.jpg
11350 Nonexistant.jpg
11351 image:foobar.jpg
11352 foobar.jpg
11353 </gallery>
11354 !! result
11355 <ul class="gallery">
11356 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11357 <div style="height: 150px;">Nonexistant.jpg</div>
11358 <div class="gallerytext">
11359 </div>
11360 </div></li>
11361 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11362 <div style="height: 150px;">Nonexistant.jpg</div>
11363 <div class="gallerytext">
11364 </div>
11365 </div></li>
11366 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11367 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11368 <div class="gallerytext">
11369 </div>
11370 </div></li>
11371 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11372 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11373 <div class="gallerytext">
11374 </div>
11375 </div></li>
11376 </ul>
11377
11378 !! end
11379
11380 !! test
11381 HTML Hex character encoding (spells the word "JavaScript")
11382 !! input
11383 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11384 !! result
11385 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11386 </p>
11387 !! end
11388
11389 !! test
11390 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11391 !! input
11392 &#xsee;&#XSEE;
11393 !! result
11394 <p>&amp;#xsee;&amp;#XSEE;
11395 </p>
11396 !! end
11397
11398 !! test
11399 HTML Hex character encoding mixed case
11400 !! input
11401 &#xEE;&#Xee;
11402 !! result
11403 <p>&#xee;&#xee;
11404 </p>
11405 !! end
11406
11407 !! test
11408 __FORCETOC__ override
11409 !! input
11410 __NEWSECTIONLINK__
11411 __FORCETOC__
11412 !! result
11413 <p><br />
11414 </p>
11415 !! end
11416
11417 !! test
11418 ISBN code coverage
11419 !! input
11420 ISBN 978-0-1234-56&#x20;789
11421 !! result
11422 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11423 </p>
11424 !! end
11425
11426 !! test
11427 ISBN followed by 5 spaces
11428 !! input
11429 ISBN
11430 !! result
11431 <p>ISBN
11432 </p>
11433 !! end
11434
11435 !! test
11436 Double ISBN
11437 !! input
11438 ISBN ISBN 1234567890
11439 !! result
11440 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11441 </p>
11442 !! end
11443
11444 !! test
11445 Bug 22905: <abbr> followed by ISBN followed by </a>
11446 !! input
11447 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11448 !! result
11449 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
11450 </p>
11451 !! end
11452
11453 !! test
11454 Double RFC
11455 !! input
11456 RFC RFC 1234
11457 !! result
11458 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11459 </p>
11460 !! end
11461
11462 !! test
11463 Double RFC with a wiki link
11464 !! input
11465 RFC [[RFC 1234]]
11466 !! result
11467 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
11468 </p>
11469 !! end
11470
11471 !! test
11472 RFC code coverage
11473 !! input
11474 RFC 983&#x20;987
11475 !! result
11476 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11477 </p>
11478 !! end
11479
11480 !! test
11481 Centre-aligned image
11482 !! input
11483 [[Image:foobar.jpg|centre]]
11484 !! result
11485 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
11486
11487 !!end
11488
11489 !! test
11490 None-aligned image
11491 !! input
11492 [[Image:foobar.jpg|none]]
11493 !! result
11494 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11495
11496 !!end
11497
11498 !! test
11499 Width + Height sized image (using px) (height is ignored)
11500 !! input
11501 [[Image:foobar.jpg|640x480px]]
11502 !! result
11503 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11504 </p>
11505 !!end
11506
11507 !! test
11508 Width-sized image (using px, no following whitespace)
11509 !! input
11510 [[Image:foobar.jpg|640px]]
11511 !! result
11512 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11513 </p>
11514 !!end
11515
11516 !! test
11517 Width-sized image (using px, with following whitespace - test regression from r39467)
11518 !! input
11519 [[Image:foobar.jpg|640px ]]
11520 !! result
11521 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11522 </p>
11523 !!end
11524
11525 !! test
11526 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11527 !! input
11528 [[Image:foobar.jpg| 640px]]
11529 !! result
11530 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11531 </p>
11532 !!end
11533
11534 !! test
11535 Another italics / bold test
11536 !! input
11537 ''' ''x'
11538 !! result
11539 <pre>'<i> </i>x'
11540 </pre>
11541 !!end
11542
11543 # Note the results may be incorrect, as parserTest output included this:
11544 # XML error: Mismatched tag at byte 6120:
11545 # ...<dd> </dt></dl> </dd...
11546 !! test
11547 dt/dd/dl test
11548 !! options
11549 disabled
11550 !! input
11551 :;;;::
11552 !! result
11553 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11554 </dd></dl>
11555 </dd></dl>
11556 </dt></dl>
11557 </dt></dl>
11558 </dt></dl>
11559 </dd></dl>
11560
11561 !!end
11562
11563
11564 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11565 !! test
11566 Images with the "|" character in the comment
11567 !! input
11568 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11569 !! result
11570 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
11571
11572 !!end
11573
11574 !! test
11575 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11576 !! input
11577 <html><script>alert(1);</script></html>
11578 !! result
11579 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11580 </p>
11581 !! end
11582
11583 !! test
11584 HTML with raw HTML ($wgRawHtml==true)
11585 !! options
11586 rawhtml
11587 !! input
11588 <html><script>alert(1);</script></html>
11589 !! result
11590 <p><script>alert(1);</script>
11591 </p>
11592 !! end
11593
11594 !! test
11595 Parents of subpages, one level up
11596 !! options
11597 subpage title=[[Subpage test/L1/L2/L3]]
11598 !! input
11599 [[../|L2]]
11600 !! result
11601 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
11602 </p>
11603 !! end
11604
11605
11606 !! test
11607 Parents of subpages, one level up, not named
11608 !! options
11609 subpage title=[[Subpage test/L1/L2/L3]]
11610 !! input
11611 [[../]]
11612 !! result
11613 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
11614 </p>
11615 !! end
11616
11617
11618
11619 !! test
11620 Parents of subpages, two levels up
11621 !! options
11622 subpage title=[[Subpage test/L1/L2/L3]]
11623 !! input
11624 [[../../|L1]]2
11625
11626 [[../../|L1]]l
11627 !! result
11628 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
11629 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
11630 </p>
11631 !! end
11632
11633 !! test
11634 Parents of subpages, two levels up, without trailing slash or name.
11635 !! options
11636 subpage title=[[Subpage test/L1/L2/L3]]
11637 !! input
11638 [[../..]]
11639 !! result
11640 <p>[[../..]]
11641 </p>
11642 !! end
11643
11644 !! test
11645 Parents of subpages, two levels up, with lots of extra trailing slashes.
11646 !! options
11647 subpage title=[[Subpage test/L1/L2/L3]]
11648 !! input
11649 [[../../////]]
11650 !! result
11651 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
11652 </p>
11653 !! end
11654
11655 !! test
11656 Definition list code coverage
11657 !! input
11658 ; title : def
11659 ; title : def
11660 ;title: def
11661 !! result
11662 <dl><dt> title &#160;</dt><dd> def
11663 </dd><dt> title&#160;</dt><dd> def
11664 </dd><dt>title</dt><dd> def
11665 </dd></dl>
11666
11667 !! end
11668
11669 !! test
11670 Don't fall for the self-closing div
11671 !! input
11672 <div>hello world</div/>
11673 !! result
11674 <div>hello world</div>
11675
11676 !! end
11677
11678 !! test
11679 MSGNW magic word
11680 !! input
11681 {{MSGNW:msg}}
11682 !! result
11683 <p>&#91;&#91;:Template:Msg&#93;&#93;
11684 </p>
11685 !! end
11686
11687 !! test
11688 RAW magic word
11689 !! input
11690 {{RAW:QUERTY}}
11691 !! result
11692 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
11693 </p>
11694 !! end
11695
11696 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11697 !! test
11698 Always escape literal '>' in output, not just after '<'
11699 !! input
11700 ><>
11701 !! result
11702 <p>&gt;&lt;&gt;
11703 </p>
11704 !! end
11705
11706 !! test
11707 Template caching
11708 !! input
11709 {{Test}}
11710 {{Test}}
11711 !! result
11712 <p>This is a test template
11713 This is a test template
11714 </p>
11715 !! end
11716
11717
11718 !! article
11719 MediaWiki:Fake
11720 !! text
11721 ==header==
11722 !! endarticle
11723
11724 !! test
11725 Inclusion of !userCanEdit() content
11726 !! input
11727 {{MediaWiki:Fake}}
11728 !! result
11729 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span></h2>
11730
11731 !! end
11732
11733
11734 !! test
11735 Out-of-order TOC heading levels
11736 !! input
11737 ==2==
11738 ======6======
11739 ===3===
11740 =1=
11741 =====5=====
11742 ==2==
11743 !! result
11744 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11745 <ul>
11746 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11747 <ul>
11748 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11749 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11750 </ul>
11751 </li>
11752 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11753 <ul>
11754 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11755 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11756 </ul>
11757 </li>
11758 </ul>
11759 </td></tr></table>
11760 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span></h2>
11761 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span></h6>
11762 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span></h3>
11763 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span></h1>
11764 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span></h5>
11765 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span></h2>
11766
11767 !! end
11768
11769
11770 !! test
11771 ISBN with a dummy number
11772 !! input
11773 ISBN ---
11774 !! result
11775 <p>ISBN ---
11776 </p>
11777 !! end
11778
11779
11780 !! test
11781 ISBN with space-delimited number
11782 !! input
11783 ISBN 92 9017 032 8
11784 !! result
11785 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11786 </p>
11787 !! end
11788
11789
11790 !! test
11791 ISBN with multiple spaces, no number
11792 !! input
11793 ISBN foo
11794 !! result
11795 <p>ISBN foo
11796 </p>
11797 !! end
11798
11799
11800 !! test
11801 ISBN length
11802 !! input
11803 ISBN 123456789
11804
11805 ISBN 1234567890
11806
11807 ISBN 12345678901
11808 !! result
11809 <p>ISBN 123456789
11810 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11811 </p><p>ISBN 12345678901
11812 </p>
11813 !! end
11814
11815
11816 !! test
11817 ISBN with trailing year (bug 8110)
11818 !! input
11819 ISBN 1-234-56789-0 - 2006
11820
11821 ISBN 1 234 56789 0 - 2006
11822 !! result
11823 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11824 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11825 </p>
11826 !! end
11827
11828
11829 !! test
11830 anchorencode
11831 !! input
11832 {{anchorencode:foo bar©#%n}}
11833 !! result
11834 <p>foo_bar.C2.A9.23.25n
11835 </p>
11836 !! end
11837
11838 !! test
11839 anchorencode trims spaces
11840 !! input
11841 {{anchorencode: __pretty__please__}}
11842 !! result
11843 <p>pretty_please
11844 </p>
11845 !! end
11846
11847 !! test
11848 anchorencode deals with links
11849 !! input
11850 {{anchorencode: [[hello|world]] [[hi]]}}
11851 !! result
11852 <p>world_hi
11853 </p>
11854 !! end
11855
11856 !! test
11857 anchorencode deals with templates
11858 !! input
11859 {{anchorencode: {{Foo}} }}
11860 !! result
11861 <p>FOO
11862 </p>
11863 !! end
11864
11865 !! test
11866 anchorencode encodes like the TOC generator: (bug 18431)
11867 !! input
11868 === _ +:.3A%3A&&amp;]] ===
11869 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11870 __NOEDITSECTION__
11871 !! result
11872 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
11873 <p>.2B:.3A.253A.26.26.5D.5D
11874 </p>
11875 !! end
11876
11877 # Expected output in the following test is not necessarily expected (there
11878 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11879 # only testing for well-formedness.
11880 !! test
11881 Bug 6200: blockquotes and paragraph formatting
11882 !! input
11883 <blockquote>
11884 foo
11885 </blockquote>
11886
11887 bar
11888
11889 baz
11890 !! result
11891 <blockquote>
11892 foo
11893 </blockquote>
11894 <p>bar
11895 </p>
11896 <pre>baz
11897 </pre>
11898 !! end
11899
11900 !! test
11901 Bug 8293: Use of center tag ruins paragraph formatting
11902 !! input
11903 <center>
11904 foo
11905 </center>
11906
11907 bar
11908
11909 baz
11910 !! result
11911 <center>
11912 <p>foo
11913 </p>
11914 </center>
11915 <p>bar
11916 </p>
11917 <pre>baz
11918 </pre>
11919 !! end
11920
11921 !!test
11922 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
11923 !!options
11924 php
11925 !!input
11926 <span><s>x</span></s>
11927 !!result
11928 <p><span><s>x&lt;/span&gt;</s></span>
11929 </p>
11930 !!end
11931
11932 !!test
11933 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
11934 !!options
11935 parsoid
11936 !!input
11937 <span><s>x</span></s>
11938 !!result
11939 <p><span><s>x</s></span><s></s>
11940 </p>
11941 !!end
11942
11943 ###
11944 ### Language variants related tests
11945 ###
11946 !! test
11947 Self-link in language variants
11948 !! options
11949 title=[[Dunav]] language=sr
11950 !! input
11951 Both [[Dunav]] and [[Дунав]] are names for this river.
11952 !! result
11953 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11954 </p>
11955 !!end
11956
11957 !! article
11958 Дуна
11959 !! text
11960 content
11961 !! endarticle
11962
11963 !! test
11964 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11965 !! options
11966 title=[[Duna]] language=sr
11967 !! input
11968 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11969 !! result
11970 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
11971 </p>
11972 !! end
11973
11974 !! test
11975 Link to pages in language variants
11976 !! options
11977 language=sr
11978 !! input
11979 Main Page can be written as [[Маин Паге]]
11980 !! result
11981 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11982 </p>
11983 !!end
11984
11985
11986 !! test
11987 Multiple links to pages in language variants
11988 !! options
11989 language=sr
11990 !! input
11991 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11992 !! result
11993 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
11994 </p>
11995 !!end
11996
11997
11998 !! test
11999 Simple template in language variants
12000 !! options
12001 language=sr
12002 !! input
12003 {{тест}}
12004 !! result
12005 <p>This is a test template
12006 </p>
12007 !! end
12008
12009
12010 !! test
12011 Template with explicit namespace in language variants
12012 !! options
12013 language=sr
12014 !! input
12015 {{Template:тест}}
12016 !! result
12017 <p>This is a test template
12018 </p>
12019 !! end
12020
12021
12022 !! test
12023 Basic test for template parameter in language variants
12024 !! options
12025 language=sr
12026 !! input
12027 {{парамтест|param=foo}}
12028 !! result
12029 <p>This is a test template with parameter foo
12030 </p>
12031 !! end
12032
12033
12034 !! test
12035 Simple category in language variants
12036 !! options
12037 language=sr cat
12038 !! input
12039 [[Category:МедиаWики Усер'с Гуиде]]
12040 !! result
12041 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
12042 !! end
12043
12044
12045 !! article
12046 Category:分类
12047 !! text
12048 blah
12049 !! endarticle
12050
12051 !! article
12052 Category:分類
12053 !! text
12054 blah
12055 !! endarticle
12056
12057 !! test
12058 Don't convert blue categorylinks to another variant (bug 33210)
12059 !! options
12060 language=zh cat
12061 !! input
12062 [[A]][[Category:分类]]
12063 !! result
12064 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12065 !! end
12066
12067
12068 !! test
12069 Stripping -{}- tags (language variants)
12070 !! options
12071 language=sr
12072 !! input
12073 Latin proverb: -{Ne nuntium necare}-
12074 !! result
12075 <p>Latin proverb: Ne nuntium necare
12076 </p>
12077 !! end
12078
12079
12080 !! test
12081 Prevent conversion with -{}- tags (language variants)
12082 !! options
12083 language=sr variant=sr-ec
12084 !! input
12085 Latinski: -{Ne nuntium necare}-
12086 !! result
12087 <p>Латински: Ne nuntium necare
12088 </p>
12089 !! end
12090
12091
12092 !! test
12093 Prevent conversion of text with -{}- tags (language variants)
12094 !! options
12095 language=sr variant=sr-ec
12096 !! input
12097 Latinski: -{Ne nuntium necare}-
12098 !! result
12099 <p>Латински: Ne nuntium necare
12100 </p>
12101 !! end
12102
12103
12104 !! test
12105 Prevent conversion of links with -{}- tags (language variants)
12106 !! options
12107 language=sr variant=sr-ec
12108 !! input
12109 -{[[Main Page]]}-
12110 !! result
12111 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12112 </p>
12113 !! end
12114
12115
12116 !! test
12117 -{}- tags within headlines (within html for parserConvert())
12118 !! options
12119 language=sr variant=sr-ec
12120 !! input
12121 == -{Naslov}- ==
12122 !! result
12123 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span></h2>
12124
12125 !! end
12126
12127
12128 !! test
12129 Explicit definition of language variant alternatives
12130 !! options
12131 language=zh variant=zh-tw
12132 !! input
12133 -{zh:China;zh-tw:Taiwan}-, not China
12134 !! result
12135 <p>Taiwan, not China
12136 </p>
12137 !! end
12138
12139
12140 !! test
12141 Conversion around HTML tags
12142 !! options
12143 language=sr variant=sr-ec
12144 !! input
12145 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12146 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12147 !! result
12148 <p>
12149 <span title="ЛаCтин">ски</span>
12150 </p>
12151 !! end
12152
12153
12154 !! test
12155 Explicit session-wise language variant mapping (A flag and - flag)
12156 !! options
12157 language=zh variant=zh-tw
12158 !! input
12159 Taiwan is not China.
12160 But -{A|zh:China;zh-tw:Taiwan}- is China,
12161 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12162 and -{China}- is China.
12163 !! result
12164 <p>Taiwan is not China.
12165 But Taiwan is Taiwan,
12166 (This should be stripped!)
12167 and China is China.
12168 </p>
12169 !! end
12170
12171 !! test
12172 Explicit session-wise language variant mapping (H flag for hide)
12173 !! options
12174 language=zh variant=zh-tw
12175 !! input
12176 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12177 Taiwan is China.
12178 !! result
12179 <p>(This should be stripped!)
12180 Taiwan is Taiwan.
12181 </p>
12182 !! end
12183
12184 !! test
12185 Adding explicit conversion rule for title (T flag)
12186 !! options
12187 language=zh variant=zh-tw showtitle
12188 !! input
12189 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12190 !! result
12191 Taiwan
12192 <p>Should be stripped!
12193 </p>
12194 !! end
12195
12196 !! test
12197 Testing that changing the language variant here in the tests actually works
12198 !! options
12199 language=zh variant=zh showtitle
12200 !! input
12201 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12202 !! result
12203 China
12204 <p>Should be stripped!
12205 </p>
12206 !! end
12207
12208 !! test
12209 Recursive conversion of alt and title attrs shouldn't clear converter state
12210 !! options
12211 language=zh variant=zh-cn showtitle
12212 !! input
12213 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12214 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12215 !! result
12216 China
12217 <p>
12218 Should be stripped<span title="Exclamation">!</span>
12219 </p>
12220 !! end
12221
12222 !! test
12223 Bug 24072: more test on conversion rule for title
12224 !! options
12225 language=zh variant=zh-tw showtitle
12226 !! input
12227 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12228 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12229 !! result
12230 Taiwan
12231 <p>This should be stripped!
12232 This won't take interferes with the title rule.
12233 </p>
12234 !! end
12235
12236 !! test
12237 Partly disable title conversion if variant == main language code
12238 !! options
12239 language=zh variant=zh title=[[ZH]] showtitle
12240 !! input
12241 -{T|zh-cn:CN;zh-tw:TW}-
12242 !! result
12243 ZH
12244 <p>
12245 </p>
12246 !! end
12247
12248 !! test
12249 Partly disable title conversion if variant == main language code, more
12250 !! options
12251 language=zh variant=zh title=[[ZH]] showtitle
12252 !! input
12253 -{T|TW}-
12254 !! result
12255 ZH
12256 <p>
12257 </p>
12258 !! end
12259
12260 !! test
12261 Raw output of variant escape tags (R flag)
12262 !! options
12263 language=zh variant=zh-tw
12264 !! input
12265 Raw: -{R|zh:China;zh-tw:Taiwan}-
12266 !! result
12267 <p>Raw: zh:China;zh-tw:Taiwan
12268 </p>
12269 !! end
12270
12271 !! test
12272 Nested using of manual convert syntax
12273 !! options
12274 language=zh variant=zh-hk
12275 !! input
12276 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12277 !! result
12278 <p>Nested: Hello Hong Kong!
12279 </p>
12280 !! end
12281
12282 !! test
12283 Proper conversion of text in external links
12284 !! options
12285 language=sr variant=sr-ec
12286 !! input
12287 http://www.google.com
12288 gopher://www.google.com
12289 [http://www.google.com http://www.google.com]
12290 [gopher://www.google.com gopher://www.google.com]
12291 [https://www.google.com irc://www.google.com]
12292 [ftp://www.google.com www.google.com/ftp://dir]
12293 [//www.google.com www.google.com]
12294 !! result
12295 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12296 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12297 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12298 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12299 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12300 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12301 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12302 </p>
12303 !! end
12304
12305 !! test
12306 Do not convert roman numbers to language variants
12307 !! options
12308 language=sr variant=sr-ec
12309 !! input
12310 Fridrih IV je car.
12311 !! result
12312 <p>Фридрих IV је цар.
12313 </p>
12314 !! end
12315
12316 !! test
12317 Unclosed language converter markup "-{"
12318 !! options
12319 language=sr
12320 !! input
12321 -{T|hello
12322 !! result
12323 <p>-{T|hello
12324 </p>
12325 !! end
12326
12327 !! test
12328 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12329 !! options
12330 language=sr
12331 !! input
12332 -{R|=&gt;}-
12333 !! result
12334 <p>=&gt;
12335 </p>
12336 !!end
12337
12338 !!article
12339 Template:Bullet
12340 !!text
12341 * Bar
12342 !!endarticle
12343
12344 !! test
12345 Bug 529: Uncovered bullet
12346 !! input
12347 * Foo {{bullet}}
12348 !! result
12349 <ul><li> Foo
12350 </li><li> Bar
12351 </li></ul>
12352
12353 !! end
12354
12355 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12356 # Templates in Wikipedia rely on this behavior, as tidy has always been
12357 # enabled there. These tests are normally run *without* tidy, so specify the
12358 # full output here.
12359 # To test realistic parsing behavior, apply a tidy-like transformation to both
12360 # the expected output and your parser's output.
12361 !! test
12362 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12363 !! input
12364 ******* Foo {{bullet}}
12365 !! result
12366 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12367 </li></ul>
12368 </li></ul>
12369 </li></ul>
12370 </li></ul>
12371 </li></ul>
12372 </li></ul>
12373 </li><li> Bar
12374 </li></ul>
12375
12376 !! end
12377
12378 !! test
12379 Bug 529: Uncovered table already at line-start
12380 !! input
12381 x
12382
12383 {{table}}
12384 y
12385 !! result
12386 <p>x
12387 </p>
12388 <table>
12389 <tr>
12390 <td> 1 </td>
12391 <td> 2
12392 </td></tr>
12393 <tr>
12394 <td> 3 </td>
12395 <td> 4
12396 </td></tr></table>
12397 <p>y
12398 </p>
12399 !! end
12400
12401 !! test
12402 Bug 529: Uncovered bullet in parser function result
12403 !! input
12404 * Foo {{lc:{{bullet}} }}
12405 !! result
12406 <ul><li> Foo
12407 </li><li> bar
12408 </li></ul>
12409
12410 !! end
12411
12412 !! test
12413 Bug 5678: Double-parsed template argument
12414 !! input
12415 {{lc:{{{1}}}|hello}}
12416 !! result
12417 <p>{{{1}}}
12418 </p>
12419 !! end
12420
12421 !! test
12422 Bug 5678: Double-parsed template invocation
12423 !! input
12424 {{lc:{{paramtest {{!}} param = hello }} }}
12425 !! result
12426 <p>{{paramtest | param = hello }}
12427 </p>
12428 !! end
12429
12430 !! test
12431 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12432 !! options
12433 language=cs
12434 title=[[Main Page]]
12435 !! input
12436 {{PRVNÍVELKÉ:ěščř}}
12437 {{prvnívelké:ěščř}}
12438 {{PRVNÍMALÉ:ěščř}}
12439 {{prvnímalé:ěščř}}
12440 {{MALÁ:ěščř}}
12441 {{malá:ěščř}}
12442 {{VELKÁ:ěščř}}
12443 {{velká:ěščř}}
12444 !! result
12445 <p>Ěščř
12446 Ěščř
12447 ěščř
12448 ěščř
12449 ěščř
12450 ěščř
12451 ĚŠČŘ
12452 ĚŠČŘ
12453 </p>
12454 !! end
12455
12456 !! test
12457 Morwen/13: Unclosed link followed by heading
12458 !! input
12459 [[link
12460 ==heading==
12461 !! result
12462 <p>[[link
12463 </p>
12464 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12465
12466 !! end
12467
12468 !! test
12469 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12470 !! input
12471 {{foo|
12472 =heading=
12473 !! result
12474 <p>{{foo|
12475 </p>
12476 <h1><span class="mw-headline" id="heading">heading</span></h1>
12477
12478 !! end
12479
12480 !! test
12481 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12482 !! input
12483 {{foo|
12484 ==heading==
12485 !! result
12486 <p>{{foo|
12487 </p>
12488 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12489
12490 !! end
12491
12492 !! test
12493 Tildes in comments
12494 !! options
12495 pst
12496 !! input
12497 <!-- ~~~~ -->
12498 !! result
12499 <!-- ~~~~ -->
12500 !! end
12501
12502 !! test
12503 Paragraphs inside divs (no extra line breaks)
12504 !! input
12505 <div>Line one
12506
12507 Line two</div>
12508 !! result
12509 <div>Line one
12510 Line two</div>
12511
12512 !! end
12513
12514 !! test
12515 Paragraphs inside divs (extra line break on open)
12516 !! input
12517 <div>
12518 Line one
12519
12520 Line two</div>
12521 !! result
12522 <div>
12523 <p>Line one
12524 </p>
12525 Line two</div>
12526
12527 !! end
12528
12529 !! test
12530 Paragraphs inside divs (extra line break on close)
12531 !! input
12532 <div>Line one
12533
12534 Line two
12535 </div>
12536 !! result
12537 <div>Line one
12538 <p>Line two
12539 </p>
12540 </div>
12541
12542 !! end
12543
12544 !! test
12545 Paragraphs inside divs (extra line break on open and close)
12546 !! input
12547 <div>
12548 Line one
12549
12550 Line two
12551 </div>
12552 !! result
12553 <div>
12554 <p>Line one
12555 </p><p>Line two
12556 </p>
12557 </div>
12558
12559 !! end
12560
12561 !! test
12562 Nesting tags, paragraphs on lines which begin with <div>
12563 !! options
12564 disabled
12565 !! input
12566 <div></div><strong>A
12567 B</strong>
12568 !! result
12569 <div></div>
12570 <p><strong>A
12571 B</strong>
12572 </p>
12573 !! end
12574
12575 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12576 !! test
12577 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12578 !! options
12579 disabled
12580 !! input
12581 <blockquote>Line one
12582
12583 Line two</blockquote>
12584 !! result
12585 <blockquote>Line one
12586 Line two</blockquote>
12587
12588 !! end
12589
12590 !! test
12591 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12592 !! options
12593 disabled
12594 !! input
12595 <blockquote>
12596 Line one
12597
12598 Line two</blockquote>
12599 !! result
12600 <blockquote>
12601 <p>Line one
12602 </p>
12603 Line two</blockquote>
12604
12605 !! end
12606
12607 !! test
12608 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12609 !! options
12610 disabled
12611 !! input
12612 <blockquote>Line one
12613
12614 Line two
12615 </blockquote>
12616 !! result
12617 <blockquote>Line one
12618 <p>Line two
12619 </p>
12620 </blockquote>
12621
12622 !! end
12623
12624 !! test
12625 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12626 !! options
12627 disabled
12628 !! input
12629 <blockquote>
12630 Line one
12631
12632 Line two
12633 </blockquote>
12634 !! result
12635 <blockquote>
12636 <p>Line one
12637 </p><p>Line two
12638 </p>
12639 </blockquote>
12640
12641 !! end
12642
12643 !! test
12644 Paragraphs inside blockquotes/divs (no extra line breaks)
12645 !! input
12646 <blockquote><div>Line one
12647
12648 Line two</div></blockquote>
12649 !! result
12650 <blockquote><div>Line one
12651 Line two</div></blockquote>
12652
12653 !! end
12654
12655 !! test
12656 Paragraphs inside blockquotes/divs (extra line break on open)
12657 !! input
12658 <blockquote><div>
12659 Line one
12660
12661 Line two</div></blockquote>
12662 !! result
12663 <blockquote><div>
12664 <p>Line one
12665 </p>
12666 Line two</div></blockquote>
12667
12668 !! end
12669
12670 !! test
12671 Paragraphs inside blockquotes/divs (extra line break on close)
12672 !! input
12673 <blockquote><div>Line one
12674
12675 Line two
12676 </div></blockquote>
12677 !! result
12678 <blockquote><div>Line one
12679 <p>Line two
12680 </p>
12681 </div></blockquote>
12682
12683 !! end
12684
12685 !! test
12686 Paragraphs inside blockquotes/divs (extra line break on open and close)
12687 !! input
12688 <blockquote><div>
12689 Line one
12690
12691 Line two
12692 </div></blockquote>
12693 !! result
12694 <blockquote><div>
12695 <p>Line one
12696 </p><p>Line two
12697 </p>
12698 </div></blockquote>
12699
12700 !! end
12701
12702 !! test
12703 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12704 !! options
12705 wgLinkHolderBatchSize=0
12706 !! input
12707 [[meatball:1]]
12708 [[meatball:2]]
12709 [[meatball:3]]
12710 !! result
12711 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12712 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12713 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12714 </p>
12715 !! end
12716
12717 !! test
12718 Free external link invading image caption
12719 !! input
12720 [[Image:Foobar.jpg|thumb|http://x|hello]]
12721 !! result
12722 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
12723
12724 !! end
12725
12726 !! test
12727 Bug 15196: localised external link numbers
12728 !! options
12729 language=fa
12730 !! input
12731 [http://en.wikipedia.org/]
12732 !! result
12733 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12734 </p>
12735 !! end
12736
12737 !! test
12738 Multibyte character in padleft
12739 !! input
12740 {{padleft:-Hello|7|Æ}}
12741 !! result
12742 <p>Æ-Hello
12743 </p>
12744 !! end
12745
12746 !! test
12747 Multibyte character in padright
12748 !! input
12749 {{padright:Hello-|7|Æ}}
12750 !! result
12751 <p>Hello-Æ
12752 </p>
12753 !! end
12754
12755 !!test
12756 formatdate parser function
12757 !!input
12758 {{#formatdate:2009-03-24}}
12759 !! result
12760 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12761 </p>
12762 !! end
12763
12764 !!test
12765 formatdate parser function, with default format
12766 !!input
12767 {{#formatdate:2009-03-24|mdy}}
12768 !! result
12769 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12770 </p>
12771 !! end
12772
12773 !! test
12774 Spacing of numbers in formatted dates
12775 !! input
12776 {{#formatdate:January 15}}
12777 !! result
12778 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12779 </p>
12780 !! end
12781
12782 !! test
12783 formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language
12784 !! options
12785 language=nl title=[[MediaWiki:Common.css]]
12786 !! input
12787 {{#formatdate:2009-03-24|dmy}}
12788 !! result
12789 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12790 </p>
12791 !! end
12792
12793 #
12794 #
12795 #
12796
12797 #
12798 # Edit comments
12799 #
12800
12801 !! test
12802 Edit comment with link
12803 !! options
12804 comment
12805 !! input
12806 I like the [[Main Page]] a lot
12807 !! result
12808 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12809 !!end
12810
12811 !! test
12812 Edit comment with link and link text
12813 !! options
12814 comment
12815 !! input
12816 I like the [[Main Page|best pages]] a lot
12817 !! result
12818 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12819 !!end
12820
12821 !! test
12822 Edit comment with link and link text with suffix
12823 !! options
12824 comment
12825 !! input
12826 I like the [[Main Page|best page]]s a lot
12827 !! result
12828 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12829 !!end
12830
12831 !! test
12832 Edit comment with section link (non-local, eg in history list)
12833 !! options
12834 comment title=[[Main Page]]
12835 !! input
12836 /* External links */ removed bogus entries
12837 !! result
12838 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12839 !!end
12840
12841 !! test
12842 Edit comment with section link and text before it (non-local, eg in history list)
12843 !! options
12844 comment title=[[Main Page]]
12845 !! input
12846 pre-comment text /* External links */ removed bogus entries
12847 !! result
12848 pre-comment text - <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12849 !!end
12850
12851 !! test
12852 Edit comment with section link (local, eg in diff view)
12853 !! options
12854 comment local title=[[Main Page]]
12855 !! input
12856 /* External links */ removed bogus entries
12857 !! result
12858 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12859 !!end
12860
12861 !! test
12862 Edit comment with subpage link (bug 14080)
12863 !! options
12864 comment
12865 subpage
12866 title=[[Subpage test]]
12867 !! input
12868 Poked at a [[/subpage]] here...
12869 !! result
12870 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12871 !!end
12872
12873 !! test
12874 Edit comment with subpage link and link text (bug 14080)
12875 !! options
12876 comment
12877 subpage
12878 title=[[Subpage test]]
12879 !! input
12880 Poked at a [[/subpage|neat little page]] here...
12881 !! result
12882 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12883 !!end
12884
12885 !! test
12886 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12887 !! options
12888 comment
12889 title=[[Subpage test]]
12890 !! input
12891 Poked at a [[/subpage]] here...
12892 !! result
12893 Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
12894 !!end
12895
12896 !! test
12897 Edit comment with bare anchor link (local, as on diff)
12898 !! options
12899 comment
12900 local
12901 title=[[Main Page]]
12902 !!input
12903 [[#section]]
12904 !! result
12905 <a href="#section">#section</a>
12906 !! end
12907
12908 !! test
12909 Edit comment with bare anchor link (non-local, as on history)
12910 !! options
12911 comment
12912 title=[[Main Page]]
12913 !!input
12914 [[#section]]
12915 !! result
12916 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12917 !! end
12918
12919 !! test
12920 Anchor starting with underscore
12921 !!input
12922 [[#_ref|One]]
12923 !! result
12924 <p><a href="#_ref">One</a>
12925 </p>
12926 !! end
12927
12928 !! test
12929 Id starting with underscore
12930 !!input
12931 <div id="_ref"></div>
12932 !! result
12933 <div id="_ref"></div>
12934
12935 !! end
12936
12937 !! test
12938 Space normalisation on autocomment (bug 22784)
12939 !! options
12940 comment
12941 title=[[Main Page]]
12942 !!input
12943 /* __hello__world__ */
12944 !! result
12945 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12946 !! end
12947
12948 !! test
12949 percent-encoding and + signs in comments (Bug 26410)
12950 !! options
12951 comment
12952 !!input
12953 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12954 !! result
12955 <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
12956 !! end
12957
12958 !! test
12959 Bad images - basic functionality
12960 !! options
12961 disabled
12962 !! input
12963 [[File:Bad.jpg]]
12964 !! result
12965 !! end
12966
12967 !! test
12968 Bad images - bug 16039: text after bad image disappears
12969 !! options
12970 disabled
12971 !! input
12972 Foo bar
12973 [[File:Bad.jpg]]
12974 Bar foo
12975 !! result
12976 <p>Foo bar
12977 </p><p>Bar foo
12978 </p>
12979 !! end
12980
12981 !! test
12982 Verify that displaytitle works (bug #22501) no displaytitle
12983 !! options
12984 showtitle
12985 !! config
12986 wgAllowDisplayTitle=true
12987 wgRestrictDisplayTitle=false
12988 !! input
12989 this is not the the title
12990 !! result
12991 Parser test
12992 <p>this is not the the title
12993 </p>
12994 !! end
12995
12996 !! test
12997 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12998 !! options
12999 showtitle
13000 title=[[Screen]]
13001 !! config
13002 wgAllowDisplayTitle=true
13003 wgRestrictDisplayTitle=false
13004 !! input
13005 this is not the the title
13006 {{DISPLAYTITLE:whatever}}
13007 !! result
13008 whatever
13009 <p>this is not the the title
13010 </p>
13011 !! end
13012
13013 !! test
13014 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13015 !! options
13016 showtitle
13017 title=[[Screen]]
13018 !! config
13019 wgAllowDisplayTitle=true
13020 wgRestrictDisplayTitle=true
13021 !! input
13022 this is not the the title
13023 {{DISPLAYTITLE:whatever}}
13024 !! result
13025 Screen
13026 <p>this is not the the title
13027 </p>
13028 !! end
13029
13030 !! test
13031 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13032 !! options
13033 showtitle
13034 title=[[Screen]]
13035 !! config
13036 wgAllowDisplayTitle=true
13037 wgRestrictDisplayTitle=true
13038 !! input
13039 this is not the the title
13040 {{DISPLAYTITLE:screen}}
13041 !! result
13042 screen
13043 <p>this is not the the title
13044 </p>
13045 !! end
13046
13047 !! test
13048 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13049 !! options
13050 showtitle
13051 title=[[Screen]]
13052 !! config
13053 wgAllowDisplayTitle=false
13054 !! input
13055 this is not the the title
13056 {{DISPLAYTITLE:screen}}
13057 !! result
13058 Screen
13059 <p>this is not the the title
13060 <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
13061 </p>
13062 !! end
13063
13064 !! test
13065 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13066 !! options
13067 showtitle
13068 title=[[Screen]]
13069 !! config
13070 wgAllowDisplayTitle=false
13071 !! input
13072 this is not the the title
13073 !! result
13074 Screen
13075 <p>this is not the the title
13076 </p>
13077 !! end
13078
13079 !! test
13080 preload: check <noinclude> and <includeonly>
13081 !! options
13082 preload
13083 !! input
13084 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13085 !! result
13086 Hello kind world.
13087 !! end
13088
13089 !! test
13090 preload: check <onlyinclude>
13091 !! options
13092 preload
13093 !! input
13094 Goodbye <onlyinclude>Hello world</onlyinclude>
13095 !! result
13096 Hello world
13097 !! end
13098
13099 !! test
13100 preload: can pass tags through if we want to
13101 !! options
13102 preload
13103 !! input
13104 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13105 !! result
13106 <includeonly>Hello world</includeonly>
13107 !! end
13108
13109 !! test
13110 preload: check that it doesn't try to do tricks
13111 !! options
13112 preload
13113 !! input
13114 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13115 !! result
13116 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13117 !! end
13118
13119 !! test
13120 Play a bit with r67090 and bug 3158
13121 !! options
13122 disabled
13123 !! input
13124 <div style="width:50% !important">&nbsp;</div>
13125 <div style="width:50%&nbsp;!important">&nbsp;</div>
13126 <div style="width:50%&#160;!important">&nbsp;</div>
13127 <div style="border : solid;">&nbsp;</div>
13128 !! result
13129 <div style="width:50% !important">&nbsp;</div>
13130 <div style="width:50% !important">&nbsp;</div>
13131 <div style="width:50% !important">&nbsp;</div>
13132 <div style="border&#160;: solid;">&nbsp;</div>
13133
13134 !! end
13135
13136 !! test
13137 HTML5 data attributes
13138 !! input
13139 <span data-foo="bar">Baz</span>
13140 <p data-abc-def_hij="">Quuz</p>
13141 !! result
13142 <p><span data-foo="bar">Baz</span>
13143 </p>
13144 <p data-abc-def_hij="">Quuz</p>
13145
13146 !! end
13147
13148 !! test
13149 percent-encoding and + signs in internal links (Bug 26410)
13150 !! input
13151 [[User:+%]] [[Page+title%]]
13152 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13153 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13154 [[%33%45]] [[%33%45+]]
13155 !! result
13156 <p><a href="/index.php?title=User:%2B%25&amp;action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&amp;action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
13157 <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&amp;action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
13158 <a href="/index.php?title=%25&amp;action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&amp;action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
13159 <a href="/index.php?title=3E&amp;action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&amp;action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
13160 </p>
13161 !! end
13162
13163 !! test
13164 Special characters in embedded file links (bug 27679)
13165 !! input
13166 [[File:Contains & ampersand.jpg]]
13167 [[File:Does not exist.jpg|Title with & ampersand]]
13168 !! result
13169 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
13170 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
13171 </p>
13172 !! end
13173
13174
13175 !! test
13176 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13177 !! input
13178 Text&apos;s been normalized?
13179 !! result
13180 <p>Text&#39;s been normalized?
13181 </p>
13182 !! end
13183
13184 !! test
13185 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13186 !! input
13187 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13188 !! result
13189 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13190 </p>
13191 !! end
13192
13193 !! test
13194 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13195 !! input
13196 [http://www.example.org/ ideograms]
13197 !! result
13198 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13199 </p>
13200 !! end
13201
13202 !! test
13203 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13204 !! input
13205 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13206 !! result
13207 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13208 </p>
13209 !! end
13210
13211 !! article
13212 Mediawiki:loop1
13213 !! text
13214 {{Identical|A}}
13215 !! endarticle
13216
13217 !! article
13218 Mediawiki:loop2
13219 !! text
13220 {{Identical|B}}
13221 !! endarticle
13222
13223 !! article
13224 Template:Identical
13225 !! text
13226 {{int:loop1}}
13227 {{int:loop2}}
13228 !! endarticle
13229
13230 !! test
13231 Bug 31098 Template which includes system messages which includes the template
13232 !! input
13233 {{Identical}}
13234 !! result
13235 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13236 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13237 </p>
13238 !! end
13239
13240 !! test
13241 Bug31490 Turkish: ucfirst 'blah'
13242 !! options
13243 language=tr
13244 !! input
13245 {{ucfirst:blah}}
13246 !! result
13247 <p>Blah
13248 </p>
13249 !! end
13250
13251 !! test
13252 Bug31490 Turkish: ucfirst 'ix'
13253 !! options
13254 language=tr
13255 !! input
13256 {{ucfirst:ix}}
13257 !! result
13258 <p>İx
13259 </p>
13260 !! end
13261
13262 !! test
13263 Bug31490 Turkish: lcfirst 'BLAH'
13264 !! options
13265 language=tr
13266 !! input
13267 {{lcfirst:BLAH}}
13268 !! result
13269 <p>bLAH
13270 </p>
13271 !! end
13272
13273 !! test
13274 Bug31490 Turkish: ucfırst (with a dotless i)
13275 !! options
13276 language=tr
13277 !! input
13278 {{ucfırst:blah}}
13279 !! result
13280 <p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
13281 </p>
13282 !! end
13283
13284 !! test
13285 Bug31490 ucfırst (with a dotless i) with English language
13286 !! options
13287 language=en
13288 !! input
13289 {{ucfırst:blah}}
13290 !! result
13291 <p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
13292 </p>
13293 !! end
13294
13295 !! test
13296 Bug 26375: TOC with italics
13297 !! options
13298 title=[[Main Page]]
13299 !! input
13300 __TOC__
13301 == ''Lost'' episodes ==
13302 !! result
13303 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13304 <ul>
13305 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
13306 </ul>
13307 </td></tr></table>
13308 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span></h2>
13309
13310 !! end
13311
13312 !! test
13313 Bug 26375: TOC with bold
13314 !! options
13315 title=[[Main Page]]
13316 !! input
13317 __TOC__
13318 == '''should be bold''' then normal text ==
13319 !! result
13320 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13321 <ul>
13322 <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
13323 </ul>
13324 </td></tr></table>
13325 <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a>]</span></h2>
13326
13327 !! end
13328
13329 !! test
13330 Bug 33845: Headings become cursive in TOC when they contain an image
13331 !! options
13332 title=[[Main Page]]
13333 !! input
13334 __TOC__
13335 == Image [[Image:foobar.jpg]] ==
13336 !! result
13337 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13338 <ul>
13339 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13340 </ul>
13341 </td></tr></table>
13342 <h2><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span></h2>
13343
13344 !! end
13345
13346 !! test
13347 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13348 !! options
13349 title=[[Main Page]]
13350 !! input
13351 __TOC__
13352 == <blockquote>Quote</blockquote> ==
13353 !! result
13354 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13355 <ul>
13356 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13357 </ul>
13358 </td></tr></table>
13359 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span></h2>
13360
13361 !! end
13362
13363 !! test
13364 Unclosed tags in TOC
13365 !! options
13366 title=[[Main Page]]
13367 !! input
13368 __TOC__
13369 == Proof: 2 < 3 ==
13370 <small>Hanc marginis exiguitas non caperet.</small>
13371 QED
13372 !! result
13373 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13374 <ul>
13375 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
13376 </ul>
13377 </td></tr></table>
13378 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span></h2>
13379 <p><small>Hanc marginis exiguitas non caperet.</small>
13380 QED
13381 </p>
13382 !! end
13383
13384 !! test
13385 Multiple tags in TOC
13386 !! input
13387 __TOC__
13388 == <i>Foo</i> <b>Bar</b> ==
13389
13390 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13391 !! result
13392 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13393 <ul>
13394 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
13395 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
13396 </ul>
13397 </td></tr></table>
13398 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span></h2>
13399 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
13400
13401 !! end
13402
13403 !! test
13404 Tags with parameters in TOC
13405 !! input
13406 __TOC__
13407 == <sup class="in-h2">Hello</sup> ==
13408
13409 == <sup class="a > b">Evilbye</sup> ==
13410 !! result
13411 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13412 <ul>
13413 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13414 <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
13415 </ul>
13416 </td></tr></table>
13417 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span></h2>
13418 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span></h2>
13419
13420 !! end
13421
13422 !! test
13423 span tags with directionality in TOC
13424 !! input
13425 __TOC__
13426 == <span dir="ltr">C++</span> ==
13427
13428 == <span dir="rtl">זבנג!</span> ==
13429
13430 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13431
13432 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13433
13434 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13435 !! result
13436 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13437 <ul>
13438 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
13439 <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
13440 <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
13441 <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
13442 <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
13443 </ul>
13444 </td></tr></table>
13445 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span></h2>
13446 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span></h2>
13447 <h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13448 <h2><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13449 <h2><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13450
13451 !! end
13452
13453 !! article
13454 MediaWiki:Bug32057
13455 !! text
13456 == {{int:headline_sample}} ==
13457 !! endarticle
13458
13459 !! test
13460 Bug 32057: Title needed when expanding <h> nodes.
13461 !! options
13462 title=[[Main Page]]
13463 !! input
13464 {{int:Bug32057}}
13465 !! result
13466 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span></h2>
13467
13468 !! end
13469
13470 !! test
13471 Strip marker in urlencode
13472 !! input
13473 {{urlencode:x<nowiki/>y}}
13474 {{urlencode:x<nowiki/>y|wiki}}
13475 {{urlencode:x<nowiki/>y|path}}
13476 !! result
13477 <p>xy
13478 xy
13479 xy
13480 </p>
13481 !! end
13482
13483 !! test
13484 Strip marker in lc
13485 !! input
13486 {{lc:x<nowiki/>y}}
13487 !! result
13488 <p>xy
13489 </p>
13490 !! end
13491
13492 !! test
13493 Strip marker in uc
13494 !! input
13495 {{uc:x<nowiki/>y}}
13496 !! result
13497 <p>XY
13498 </p>
13499 !! end
13500
13501 !! test
13502 Strip marker in formatNum
13503 !! input
13504 {{formatnum:1<nowiki/>2}}
13505 {{formatnum:1<nowiki/>2|R}}
13506 !! result
13507 <p>12
13508 12
13509 </p>
13510 !! end
13511
13512 !! test
13513 Check noCommafy in formatNum
13514 !! options
13515 language=be-tarask
13516 !! input
13517 {{formatnum:123456.78}}
13518 {{formatnum:123456.78|NOSEP}}
13519 !! result
13520 <p>123 456,78
13521 123456.78
13522 </p>
13523 !! end
13524
13525 !! test
13526 Strip marker in grammar
13527 !! options
13528 language=fi
13529 !! input
13530 {{grammar:elative|foo<nowiki/>bar}}
13531 !! result
13532 <p>foobarista
13533 </p>
13534 !! end
13535
13536 !! test
13537 Strip marker in padleft
13538 !! input
13539 {{padleft:|2|x<nowiki/>y}}
13540 !! result
13541 <p>xy
13542 </p>
13543 !! end
13544
13545 !! test
13546 Strip marker in padright
13547 !! input
13548 {{padright:|2|x<nowiki/>y}}
13549 !! result
13550 <p>xy
13551 </p>
13552 !! end
13553
13554 !! test
13555 Strip marker in anchorencode
13556 !! input
13557 {{anchorencode:x<nowiki/>y}}
13558 !! result
13559 <p>xy
13560 </p>
13561 !! end
13562
13563 !! test
13564 nowiki inside link inside heading (bug 18295)
13565 !! input
13566 ==[[foo|x<nowiki>y</nowiki>z]]==
13567 !! result
13568 <h2><span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">xyz</a></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span></h2>
13569
13570 !! end
13571
13572 !! test
13573 new support for bdi element (bug 31817)
13574 !! input
13575 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13576 !! result
13577 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13578
13579 !!end
13580
13581 !! test
13582 Ignore pipe between table row attributes
13583 !! input
13584 {|
13585 | quux
13586 |- id=foo | style='color: red'
13587 | bar
13588 |}
13589 !! result
13590 <table>
13591 <tr>
13592 <td> quux
13593 </td></tr>
13594 <tr id="foo" style="color: red">
13595 <td> bar
13596 </td></tr></table>
13597
13598 !! end
13599
13600 !!test
13601 Gallery override link with WikiLink (bug 34852)
13602 !! input
13603 <gallery>
13604 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13605 </gallery>
13606 !! result
13607 <ul class="gallery">
13608 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13609 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13610 <div class="gallerytext">
13611 <p>caption
13612 </p>
13613 </div>
13614 </div></li>
13615 </ul>
13616
13617 !! end
13618
13619 !!test
13620 Gallery override link with absolute external link (bug 34852)
13621 !! input
13622 <gallery>
13623 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13624 </gallery>
13625 !! result
13626 <ul class="gallery">
13627 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13628 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13629 <div class="gallerytext">
13630 <p>caption
13631 </p>
13632 </div>
13633 </div></li>
13634 </ul>
13635
13636 !! end
13637
13638 !!test
13639 Gallery override link with malicious javascript (bug 34852)
13640 !! input
13641 <gallery>
13642 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13643 </gallery>
13644 !! result
13645 <ul class="gallery">
13646 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13647 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13648 <div class="gallerytext">
13649 <p>caption
13650 </p>
13651 </div>
13652 </div></li>
13653 </ul>
13654
13655 !! end
13656
13657 !!test
13658 Gallery with invalid title as link (bug 43964)
13659 !! input
13660 <gallery>
13661 File:foobar.jpg|link=<
13662 </gallery>
13663 !! result
13664 <ul class="gallery">
13665 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13666 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13667 <div class="gallerytext">
13668 </div>
13669 </div></li>
13670 </ul>
13671
13672 !! end
13673
13674 !!test
13675 Language parser function
13676 !! input
13677 {{#language:ar}}
13678 !! result
13679 <p>العربية
13680 </p>
13681 !! end
13682
13683 !!test
13684 Padleft and padright as substr
13685 !! input
13686 {{padleft:|3|abcde}}
13687 {{padright:|3|abcde}}
13688 !! result
13689 <p>abc
13690 abc
13691 </p>
13692 !! end
13693
13694 !!test
13695 Bug 34939 - Case insensitive link parsing ([HttP://])
13696 !! input
13697 [HttP://MediaWiki.Org/]
13698 !! result
13699 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13700 </p>
13701 !! end
13702
13703 !!test
13704 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13705 !! input
13706 [HttP://MediaWiki.Org/ MediaWiki]
13707 !! result
13708 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13709 </p>
13710 !! end
13711
13712 !!test
13713 Bug 34939 - Case insensitive link parsing (HttP://)
13714 !! input
13715 HttP://MediaWiki.Org/
13716 !! result
13717 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13718 </p>
13719 !! end
13720
13721 ###
13722 ### Parsoids-specific tests
13723 ### Parsoid-PHP parser incompatibilities
13724 ###
13725 !!test
13726 1. SOL-sensitive wikitext tokens as template-args
13727 !!options
13728 parsoid=wt2html,wt2wt
13729 !!input
13730 {{echo|*a}}
13731 {{echo|#a}}
13732 {{echo|:a}}
13733 !!result
13734 <span about="#mwt1" typeof="mw:Object/Template">
13735 </span><ul about="#mwt1"><li>a</li></ul>
13736 <span about="#mwt2" typeof="mw:Object/Template">
13737 </span><ol about="#mwt2"><li>a</li></ol>
13738 <span about="#mwt3" typeof="mw:Object/Template">
13739 </span><dl about="#mwt3"><dd>a</dd></dl>
13740 !!end
13741
13742 #### The following section of tests are primarily to test
13743 #### wikitext escaping capabilities of Parsoid. Given that
13744 #### escaping can be done any number of ways, the wikitext (input)
13745 #### is always adjusted to reflect how Parsoid adds nowiki
13746 #### escape tags.
13747 ####
13748 #### We are marking several tests as parsoid-only since the
13749 #### HTML in the result section is different from what the
13750 #### PHP parser generates for it.
13751
13752
13753 #### --------------- Headings ---------------
13754 #### 0. Unnested
13755 #### 1. Nested inside html <h1>=foo=</h1>
13756 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13757 #### 3. Nested inside html with wikitext split by html tags
13758 #### 4. No escape needed
13759 #### 5. Empty headings <h1></h1>
13760 #### 6. Heading chars in SOL context
13761 #### ----------------------------------------
13762 !! test
13763 Headings: 0. Unnested
13764 !! options
13765 parsoid
13766 !! input
13767 <nowiki>=foo=</nowiki>
13768
13769 <nowiki> =foo= </nowiki>
13770 <!--cmt-->
13771 <nowiki>=foo=</nowiki>
13772
13773 =foo''a''<nowiki>=</nowiki>
13774 !! result
13775 <p><span typeof="mw:Nowiki">=foo=</span></p>
13776
13777 <p><span typeof="mw:Nowiki"> =foo= </span>
13778 <!--cmt-->
13779 <span typeof="mw:Nowiki">=foo=</span></p>
13780
13781 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
13782 !!end
13783
13784 !! test
13785 Headings: 1. Nested inside html
13786 !! options
13787 parsoid
13788 !! input
13789 =<nowiki>=foo=</nowiki>=
13790 ==<nowiki>=foo=</nowiki>==
13791 ===<nowiki>=foo=</nowiki>===
13792 ====<nowiki>=foo=</nowiki>====
13793 =====<nowiki>=foo=</nowiki>=====
13794 ======<nowiki>=foo=</nowiki>======
13795 !! result
13796 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
13797 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
13798 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
13799 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
13800 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
13801 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
13802 !!end
13803
13804 !! test
13805 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13806 !! options
13807 parsoid
13808 !! input
13809 =foo=
13810 <nowiki>*bar</nowiki>
13811 =foo=
13812 =bar
13813 =foo=
13814 <nowiki>=bar=</nowiki>
13815 !! result
13816 <h1>foo</h1>*bar
13817 <h1>foo</h1>=bar
13818 <h1>foo</h1>=bar=
13819 !!end
13820
13821 !! test
13822 Headings: 3. Nested inside html with wikitext split by html tags
13823 !! options
13824 parsoid
13825 !! input
13826 =='''bold'''<nowiki>foo=</nowiki>=
13827 !! result
13828 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
13829 !!end
13830
13831 !! test
13832 Headings: 4a. No escaping needed (testing just h1 and h2)
13833 !! options
13834 parsoid
13835 !! input
13836 ==foo=
13837 =foo==
13838 = =foo= =
13839 ==foo= bar=
13840 ===foo==
13841 ==foo===
13842 =''=''foo==
13843 =<nowiki>=</nowiki>=
13844 !! result
13845 <h1>=foo</h1>
13846 <h1>foo=</h1>
13847 <h1> =foo= </h1>
13848 <h1>=foo= bar</h1>
13849 <h2>=foo</h2>
13850 <h2>foo=</h2>
13851 <h1><i>=</i>foo=</h1>
13852 <h1><span typeof="mw:Nowiki">=</span></h1>
13853 !!end
13854
13855 !! test
13856 Headings: 4b. No escaping needed (inside p-tags)
13857 !! options
13858 parsoid
13859 !! input
13860 ===
13861 =foo= x
13862 =foo= <s></s>
13863 !! result
13864 <p>===
13865 =foo= x
13866 =foo= <s></s>
13867 </p>
13868 !!end
13869
13870 !! test
13871 Headings: 5. Empty headings
13872 !! options
13873 parsoid
13874 !! input
13875 =<nowiki/>=
13876 ==<nowiki/>==
13877 ===<nowiki/>===
13878 ====<nowiki/>====
13879 =====<nowiki/>=====
13880 ======<nowiki/>======
13881 !! result
13882 <h1></h1>
13883 <h2></h2>
13884 <h3></h3>
13885 <h4></h4>
13886 <h5></h5>
13887 <h6></h6>
13888 !!end
13889
13890 !! test
13891 Headings: 6. Heading chars in SOL context
13892 !! options
13893 parsoid
13894 !! input
13895 <!--cmt--><nowiki>=h1=</nowiki>
13896 <!--cmt--><nowiki> =h1= </nowiki>
13897 !! result
13898 <p><!--cmt--><span typeof="mw:Nowiki">=h1=</span>
13899 <!--cmt--><span typeof="mw:Nowiki"> =h1= </span></p>
13900 !!end
13901
13902 #### --------------- Lists ---------------
13903 #### 0. Outside nests (*foo, etc.)
13904 #### 1. Nested inside html <ul><li>*foo</li></ul>
13905 #### 2. Inside definition lists
13906 #### 3. Only bullets at start should be escaped
13907 #### 4. No escapes needed
13908 #### 5. No unnecessary escapes
13909 #### 6. Escape bullets in SOL position
13910 #### 7. Escape bullets in a multi-line context
13911 #### ----------------------------------------
13912
13913 !! test
13914 Lists: 0. Outside nests
13915 !! input
13916 <nowiki>*foo</nowiki>
13917
13918 <nowiki>#foo</nowiki>
13919 !! result
13920 <p>*foo
13921 </p><p>#foo
13922 </p>
13923 !!end
13924
13925 !! test
13926 Lists: 1. Nested inside html
13927 !! input
13928 *<nowiki>*foo</nowiki>
13929
13930 *<nowiki>#foo</nowiki>
13931
13932 *<nowiki>:foo</nowiki>
13933
13934 *<nowiki>;foo</nowiki>
13935
13936 #<nowiki>*foo</nowiki>
13937
13938 #<nowiki>#foo</nowiki>
13939
13940 #<nowiki>:foo</nowiki>
13941
13942 #<nowiki>;foo</nowiki>
13943 !! result
13944 <ul><li>*foo
13945 </li></ul>
13946 <ul><li>#foo
13947 </li></ul>
13948 <ul><li>:foo
13949 </li></ul>
13950 <ul><li>;foo
13951 </li></ul>
13952 <ol><li>*foo
13953 </li></ol>
13954 <ol><li>#foo
13955 </li></ol>
13956 <ol><li>:foo
13957 </li></ol>
13958 <ol><li>;foo
13959 </li></ol>
13960
13961 !!end
13962
13963 !! test
13964 Lists: 2. Inside definition lists
13965 !! input
13966 ;<nowiki>;foo</nowiki>
13967
13968 ;<nowiki>:foo</nowiki>
13969
13970 ;<nowiki>:foo</nowiki>
13971 :bar
13972
13973 :<nowiki>:foo</nowiki>
13974 !! result
13975 <dl><dt>;foo
13976 </dt></dl>
13977 <dl><dt>:foo
13978 </dt></dl>
13979 <dl><dt>:foo
13980 </dt><dd>bar
13981 </dd></dl>
13982 <dl><dd>:foo
13983 </dd></dl>
13984
13985 !!end
13986
13987 !! test
13988 Lists: 3. Only bullets at start of text should be escaped
13989 !! input
13990 *<nowiki>*foo*bar</nowiki>
13991
13992 *<nowiki>*foo</nowiki>''it''*bar
13993 !! result
13994 <ul><li>*foo*bar
13995 </li></ul>
13996 <ul><li>*foo<i>it</i>*bar
13997 </li></ul>
13998
13999 !!end
14000
14001 !! test
14002 Lists: 4. No escapes needed
14003 !! options
14004 parsoid
14005 !! input
14006 *foo*bar
14007
14008 *''foo''*bar
14009
14010 *[[Foo]]: bar
14011 !! result
14012 <ul><li>foo*bar
14013 </li></ul>
14014 <ul><li><i>foo</i>*bar
14015 </li></ul>
14016 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
14017 </li></ul>
14018 !!end
14019
14020 !! test
14021 Lists: 5. No unnecessary escapes
14022 !! input
14023 * bar <span><nowiki>[[foo]]</nowiki></span>
14024
14025 *=bar <span><nowiki>[[foo]]</nowiki></span>
14026
14027 *[[bar <span><nowiki>[[foo]]</nowiki></span>
14028
14029 *]]bar <span><nowiki>[[foo]]</nowiki></span>
14030
14031 *=bar <span>foo]]</span>=
14032
14033 * <s></s>: a
14034 !! result
14035 <ul><li> bar <span>[[foo]]</span>
14036 </li></ul>
14037 <ul><li>=bar <span>[[foo]]</span>
14038 </li></ul>
14039 <ul><li>[[bar <span>[[foo]]</span>
14040 </li></ul>
14041 <ul><li>]]bar <span>[[foo]]</span>
14042 </li></ul>
14043 <ul><li>=bar <span>foo]]</span>=
14044 </li></ul>
14045 <ul><li> <s></s>: a
14046 </li></ul>
14047
14048 !!end
14049
14050 !! test
14051 Lists: 6. Escape bullets in SOL position
14052 !! options
14053 parsoid
14054 !! input
14055 <!--cmt--><nowiki>*foo</nowiki>
14056 !! result
14057 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
14058 !!end
14059
14060 !! test
14061 Lists: 7. Escape bullets in a multi-line context
14062 !! input
14063 <nowiki>a
14064 *b</nowiki>
14065 !! result
14066 <p>a
14067 *b
14068 </p>
14069 !!end
14070
14071 #### --------------- HRs ---------------
14072 #### 1. Single line
14073 #### -----------------------------------
14074
14075 !! test
14076 HRs: 1. Single line
14077 !! options
14078 parsoid
14079 !! input
14080 ----<nowiki>----</nowiki>
14081 ----=foo=
14082 ----*foo
14083 !! result
14084 <hr><span typeof="mw:Nowiki">----</span>
14085 <hr>=foo=
14086 <hr>*foo
14087 !! end
14088
14089 #### --------------- Tables ---------------
14090 #### 1a. Simple example
14091 #### 1b. No escaping needed (!foo)
14092 #### 1c. No escaping needed (|foo)
14093 #### 1d. No escaping needed (|}foo)
14094 ####
14095 #### 2a. Nested in td (<td>foo|bar</td>)
14096 #### 2b. Nested in td (<td>foo||bar</td>)
14097 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
14098 ####
14099 #### 3a. Nested in th (<th>foo!bar</th>)
14100 #### 3b. Nested in th (<th>foo!!bar</th>)
14101 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
14102 ####
14103 #### 4a. Escape -
14104 #### 4b. Escape +
14105 #### 4c. No escaping needed
14106 #### --------------------------------------
14107
14108 !! test
14109 Tables: 1a. Simple example
14110 !! input
14111 <nowiki>{|
14112 |}</nowiki>
14113 !! result
14114 <p>{|
14115 |}
14116 </p>
14117 !! end
14118
14119 !! test
14120 Tables: 1b. No escaping needed
14121 !! input
14122 !foo
14123 !! result
14124 <p>!foo
14125 </p>
14126 !! end
14127
14128 !! test
14129 Tables: 1c. No escaping needed
14130 !! input
14131 |foo
14132 !! result
14133 <p>|foo
14134 </p>
14135 !! end
14136
14137 !! test
14138 Tables: 1d. No escaping needed
14139 !! input
14140 |}foo
14141 !! result
14142 <p>|}foo
14143 </p>
14144 !! end
14145
14146 !! test
14147 Tables: 2a. Nested in td
14148 !! options
14149 parsoid
14150 !! input
14151 {|
14152 |<nowiki>foo|bar</nowiki>
14153 |}
14154 !! result
14155 <table><tbody><tr>
14156 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
14157 !! end
14158
14159 !! test
14160 Tables: 2b. Nested in td
14161 !! options
14162 parsoid
14163 !! input
14164 {|
14165 |<nowiki>foo||bar</nowiki>
14166 |''it''<nowiki>foo||bar</nowiki>
14167 |}
14168 !! result
14169 <table><tbody><tr>
14170 <td><span typeof="mw:Nowiki">foo||bar</span></td>
14171 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
14172 !! end
14173
14174 !! test
14175 Tables: 2c. Nested in td -- no escaping needed
14176 !! options
14177 parsoid
14178 !! input
14179 {|
14180 |foo!!bar
14181 |}
14182 !! result
14183 <table><tbody><tr><td>foo!!bar
14184 </td></tr></tbody></table>
14185
14186 !! end
14187
14188 !! test
14189 Tables: 3a. Nested in th
14190 !! options
14191 parsoid
14192 !! input
14193 {|
14194 !foo!bar
14195 |}
14196 !! result
14197 <table><tbody><tr><th>foo!bar
14198 </th></tr></tbody></table>
14199
14200 !! end
14201
14202 !! test
14203 Tables: 3b. Nested in th
14204 !! options
14205 parsoid
14206 !! input
14207 {|
14208 !<nowiki>foo!!bar</nowiki>
14209 |}
14210 !! result
14211 <table>
14212 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
14213 </tbody></table>
14214 !! end
14215
14216 !! test
14217 Tables: 3c. Nested in th -- no escaping needed
14218 !! options
14219 parsoid
14220 !! input
14221 {|
14222 !<nowiki>foo||bar</nowiki>
14223 |}
14224 !! result
14225 <table><tbody><tr>
14226 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
14227 !! end
14228
14229 !! test
14230 Tables: 4a. Escape -
14231 !! options
14232 parsoid
14233 !! input
14234 {|
14235 |-
14236 !-bar
14237 |-
14238 |<nowiki>-bar</nowiki>
14239 |}
14240 !! result
14241 <table><tbody>
14242 <tr><th>-bar</th></tr>
14243 <tr>
14244 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
14245 !! end
14246
14247 !! test
14248 Tables: 4b. Escape +
14249 !! options
14250 parsoid
14251 !! input
14252 {|
14253 |-
14254 !+bar
14255 |-
14256 |<nowiki>+bar</nowiki>
14257 |}
14258 !! result
14259 <table><tbody>
14260 <tr><th>+bar</th></tr>
14261 <tr>
14262 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
14263 !! end
14264
14265 !! test
14266 Tables: 4c. No escaping needed
14267 !! options
14268 parsoid
14269 !! input
14270 {|
14271 |-
14272 |foo-bar
14273 |foo+bar
14274 |-
14275 |''foo''-bar
14276 |''foo''+bar
14277 |}
14278 !! result
14279 <table><tbody>
14280 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14281 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14282 </tbody></table>
14283 !! end
14284
14285 ### SSS FIXME: Disabled right now because accurate html2wt
14286 ### on this snippet requires data-parsoid flags that we've
14287 ### stripped out of these tests. We should scheme how we
14288 ### we want to handle these kind of tests that require
14289 ### data-parsoid flags for accurate html2wt serialization
14290
14291 !! test
14292 Tables: 4d. No escaping needed
14293 !! options
14294 disabled
14295 !! input
14296 {|
14297 ||+1
14298 ||-2
14299 |}
14300 !! result
14301 <table>
14302 <tr>
14303 <td>+1
14304 </td>
14305 <td>-2
14306 </td></tr></table>
14307
14308 !! end
14309
14310 #### --------------- Links ---------------
14311 #### 1. Quote marks in link text
14312 #### 2. Wikilinks: Escapes needed
14313 #### 3. Wikilinks: No escapes needed
14314 #### 4. Extlinks: Escapes needed
14315 #### 5. Extlinks: No escapes needed
14316 #### --------------------------------------
14317 !! test
14318 Links 1. Quote marks in link text
14319 !! options
14320 parsoid
14321 !! input
14322 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14323 !! result
14324 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14325 !! end
14326
14327 !! test
14328 Links 2. WikiLinks: Escapes needed
14329 !! options
14330 parsoid
14331 !! input
14332 [[Foo|<nowiki>[Foobar]</nowiki>]]
14333 [[Foo|<nowiki>Foobar]</nowiki>]]
14334 [[Foo|x [Foobar] x]]
14335 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14336 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14337 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14338 [[Foo|<nowiki>|Bar</nowiki>]]
14339 [[Foo|<nowiki>]]bar</nowiki>]]
14340 [[Foo|<nowiki>[[bar</nowiki>]]
14341 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
14342 !! result
14343 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14344 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14345 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14346 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14347 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14348 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14349 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14350 <a href="Foo" rel="mw:WikiLink">]]bar</a>
14351 <a href="Foo" rel="mw:WikiLink">[[bar</a>
14352 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
14353 !! end
14354
14355 !! test
14356 Links 3. WikiLinks: No escapes needed
14357 !! options
14358 parsoid
14359 !! input
14360 [[Foo|[Foobar]]
14361 [[Foo|foo|bar]]
14362 !! result
14363 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14364 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14365 !! end
14366
14367 !! test
14368 Links 4. ExtLinks: Escapes needed
14369 !! options
14370 parsoid
14371 !! input
14372 [http://google.com <nowiki>[google]</nowiki>]
14373 [http://google.com <nowiki>google]</nowiki>]
14374 !! result
14375 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14376 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14377 !! end
14378
14379 !! test
14380 Links 5. ExtLinks: No escapes needed
14381 !! options
14382 parsoid
14383 !! input
14384 [http://google.com [google]
14385 !! result
14386 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14387 !! end
14388
14389 #### --------------- Quotes ---------------
14390 #### 1. Quotes inside <b> and <i>
14391 #### 2. Link fragments separated by <i> and <b> tags
14392 #### 3. Link fragments inside <i> and <b>
14393 #### --------------------------------------
14394 !! test
14395 1. Quotes inside <b> and <i>
14396 !! input
14397 ''<nowiki>'foo'</nowiki>''
14398 ''<nowiki>''foo''</nowiki>''
14399 ''<nowiki>'''foo'''</nowiki>''
14400 '''<nowiki>'foo'</nowiki>'''
14401 '''<nowiki>''foo''</nowiki>'''
14402 '''<nowiki>'''foo'''</nowiki>'''
14403 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14404 !! result
14405 <p><i>'foo'</i>
14406 <i>''foo''</i>
14407 <i>'''foo'''</i>
14408 <b>'foo'</b>
14409 <b>''foo''</b>
14410 <b>'''foo'''</b>
14411 <b>foo'<i>bar'</i>baz</b>
14412 </p>
14413 !! end
14414
14415 !! test
14416 2. Link fragments separated by <i> and <b> tags
14417 !! input
14418 [[''foo''<nowiki>hello]]</nowiki>
14419
14420 [['''foo'''<nowiki>hello]]</nowiki>
14421 !! result
14422 <p>[[<i>foo</i>hello]]
14423 </p><p>[[<b>foo</b>hello]]
14424 </p>
14425 !! end
14426
14427 !! test
14428 2. Link fragments inside <i> and <b>
14429 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14430 this is one of the shortcomings of this format)
14431 !! input
14432 ''[[foo''<nowiki>]]</nowiki>
14433
14434 '''[[foo'''<nowiki>]]</nowiki>
14435 !! result
14436 <p><i>[[foo</i>]]
14437 </p><p><b>[[foo</b>]]
14438 </p>
14439 !! end
14440
14441 #### --------------- Paragraphs ---------------
14442 #### 1. No unnecessary escapes
14443 #### --------------------------------------
14444
14445 !! test
14446 1. No unnecessary escapes
14447 !! input
14448 bar <span><nowiki>[[foo]]</nowiki></span>
14449
14450 =bar <span><nowiki>[[foo]]</nowiki></span>
14451
14452 [[bar <span><nowiki>[[foo]]</nowiki></span>
14453
14454 ]]bar <span><nowiki>[[foo]]</nowiki></span>
14455
14456 =bar <span>foo]]</span><nowiki>=</nowiki>
14457 !! result
14458 <p>bar <span>[[foo]]</span>
14459 </p><p>=bar <span>[[foo]]</span>
14460 </p><p>[[bar <span>[[foo]]</span>
14461 </p><p>]]bar <span>[[foo]]</span>
14462 </p><p>=bar <span>foo]]</span>=
14463 </p>
14464 !!end
14465
14466 #### --------------- PRE ------------------
14467 #### 1. Leading space in SOL context should be escaped
14468 #### --------------------------------------
14469 !! test
14470 1. Leading space in SOL context should be escaped
14471 !! options
14472 parsoid
14473 !! input
14474 <nowiki> foo</nowiki>
14475 <!--cmt--><nowiki> foo</nowiki>
14476 !! result
14477 <p> foo
14478 <!--cmt--> foo
14479 </p>
14480 !! end
14481
14482 #### --------------- HTML tags ---------------
14483 #### 1. a tags
14484 #### 2. other tags
14485 #### 3. multi-line html tag
14486 #### --------------------------------------
14487 !! test
14488 1. a tags
14489 !! options
14490 parsoid
14491 !! input
14492 <a href="http://google.com">google</a>
14493 !! result
14494 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14495 !! end
14496
14497 !! test
14498 2. other tags
14499 !! input
14500 <nowiki><div>foo</div>
14501 <div style="color:red">foo</div></nowiki>
14502 !! result
14503 <p>&lt;div&gt;foo&lt;/div&gt;
14504 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14505 </p>
14506 !! end
14507
14508 !! test
14509 3. multi-line html tag
14510 !! input
14511 <nowiki><div
14512 >foo</div
14513 ></nowiki>
14514 !! result
14515 <p>&lt;div
14516 &gt;foo&lt;/div
14517 &gt;
14518 </p>
14519 !! end
14520
14521 #### --------------- Others ---------------
14522 !! test
14523 Escaping nowikis
14524 !! input
14525 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14526 !! result
14527 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14528 </p>
14529 !! end
14530 !! test
14531
14532 Tag-like HTML structures are passed through as text
14533 !! input
14534 <x y>
14535
14536 <x.y>
14537
14538 <x-y>
14539
14540 1>2
14541
14542 x<y
14543
14544 a>b
14545
14546 1<d e>f
14547 !! result
14548 <p>&lt;x y&gt;
14549 </p><p>&lt;x.y&gt;
14550 </p><p>&lt;x-y&gt;
14551 </p><p>1&gt;2
14552 </p><p>x&lt;y
14553 </p><p>a&gt;b
14554 </p><p>1&lt;d e&gt;f
14555 </p>
14556 !! end
14557
14558
14559 # This fails in the PHP parser (see bug 40670,
14560 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14561 !! test
14562 Tag names followed by punctuation should not be recognized as tags
14563 !! options
14564 parsoid
14565 !! input
14566 <s.ome> text
14567 !! result
14568 <p>&lt;s.ome&gt; text
14569 </p>
14570 !! end
14571
14572 !! test
14573 HTML tag with necessary entities in attributes
14574 !! input
14575 <span title="&amp;amp;">foo</span>
14576 !! result
14577 <p><span title="&amp;amp;">foo</span>
14578 </p>
14579 !! end
14580
14581 !! test
14582 HTML tag with 'unnecessary' entity encoding in attributes
14583 !! input
14584 <span title="&amp;">foo</span>
14585 !! result
14586 <p><span title="&amp;">foo</span>
14587 </p>
14588 !! end
14589
14590 !! test
14591 HTML tag with broken attribute value quoting
14592 !! input
14593 <span title="Hello world>Foo</span>
14594 !! result
14595 <p><span>Foo</span>
14596 </p>
14597 !! end
14598
14599 !! test
14600 Parsoid-only: HTML tag with broken attribute value quoting
14601 !! options
14602 parsoid
14603 !! input
14604 <span title="Hello world>Foo</span>
14605 !! result
14606 <p><span title="Hello world">Foo</span>
14607 </p>
14608 !! end
14609
14610 !! test
14611 Table with broken attribute value quoting
14612 !! input
14613 {|
14614 | title="Hello world|Foo
14615 |}
14616 !! result
14617 <table>
14618 <tr>
14619 <td>Foo
14620 </td></tr></table>
14621
14622 !! end
14623
14624 !! test
14625 Table with broken attribute value quoting on consecutive lines
14626 !! input
14627 {|
14628 | title="Hello world|Foo
14629 | style="color:red|Bar
14630 |}
14631 !! result
14632 <table>
14633 <tr>
14634 <td>Foo
14635 </td>
14636 <td>Bar
14637 </td></tr></table>
14638
14639 !! end
14640
14641 !! test
14642 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14643 !! options
14644 parsoid
14645 !! input
14646 {|
14647 | title="Hello world|Foo
14648 | style="color:red|Bar
14649 |}
14650 !! result
14651 <table><tbody>
14652 <tr>
14653 <td title="Hello world">Foo
14654 </td><td style="color: red">Bar
14655 </td></tr></tbody></table>
14656
14657 !! end
14658
14659 !! test
14660 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14661 !! options
14662 parsoid
14663 !! input
14664 {{}}
14665 !! result
14666 {{}}
14667 !! end
14668
14669 !! test
14670 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14671 !! options
14672 parsoid
14673 !! input
14674 }}{{
14675 !! result
14676 }}{{
14677 !! end
14678
14679 !!test
14680 Accept empty td cell attribute
14681 !!input
14682 {|
14683 | align="center" | foo || |
14684 |}
14685 !!result
14686 <table>
14687 <tr>
14688 <td align="center"> foo </td>
14689 <td>
14690 </td></tr></table>
14691
14692 !!end
14693
14694 !!test
14695 Non-empty attributes in th-cells
14696 !!input
14697 {|
14698 ! Foo !! style="color: red" | Bar
14699 |}
14700 !!result
14701 <table>
14702 <tr>
14703 <th> Foo </th>
14704 <th style="color: red"> Bar
14705 </th></tr></table>
14706
14707 !!end
14708
14709 !!test
14710 Accept empty attributes in th-cells
14711 !!input
14712 {|
14713 !| foo !!| bar
14714 |}
14715 !!result
14716 <table>
14717 <tr>
14718 <th> foo </th>
14719 <th> bar
14720 </th></tr></table>
14721
14722 !!end
14723
14724 !!test
14725 Empty table rows go away
14726 !!input
14727 {|
14728 | Hello
14729 | there
14730 |- class="foo"
14731 |-
14732 |}
14733 !! result
14734 <table>
14735 <tr>
14736 <td> Hello
14737 </td>
14738 <td> there
14739 </td></tr>
14740
14741 </table>
14742
14743 !! end
14744
14745 ###
14746 ### Parsoid-centric tests for testing RTing of inter-element separators
14747 ### Edge cases not tested by existing parser tests and specific to
14748 ### Parsoid-specific serialization strategies.
14749 ###
14750
14751 !!test
14752 RT-ed inter-element separators should be valid separators
14753 !!input
14754 {|
14755 |- [[foo]]
14756 |}
14757 !!result
14758 <table>
14759
14760 </table>
14761
14762 !!end
14763
14764 !!test
14765 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14766 (Parsoid-only since PHP parser relies on Tidy for correct output)
14767 !!options
14768 parsoid
14769 !!input
14770 {|
14771 |<small>foo
14772 bar
14773 |}
14774
14775 {|
14776 |<small>foo<small>
14777 |}
14778 !!result
14779 !!end
14780
14781 !!test
14782 Empty TD followed by TD with tpl-generated attribute
14783 !!input
14784 {|
14785 |-
14786 |
14787 |{{echo|style='color:red'}}|foo
14788 |}
14789 !!result
14790 <table>
14791
14792 <tr>
14793 <td>
14794 </td>
14795 <td>foo
14796 </td></tr></table>
14797
14798 !!end
14799
14800 !!test
14801 Indented table with an empty td
14802 !!input
14803 {|
14804 |-
14805 |
14806 |foo
14807 |}
14808 !!result
14809 <table>
14810
14811 <tr>
14812 <td>
14813 </td>
14814 <td>foo
14815 </td></tr></table>
14816
14817 !!end
14818
14819 !!test
14820 Empty TR followed by a template-generated TR
14821 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14822 !!options
14823 parsoid=wt2html,wt2wt
14824 !!input
14825 {|
14826 |-
14827 {{echo|<tr><td>foo</td></tr>}}
14828 |}
14829 !!result
14830 <table>
14831 <tbody>
14832 <tr></tr>
14833 <tr typeof="mw:Object/Template">
14834 <td>foo</td></tr></tbody></table>
14835 !!end
14836
14837 ## PHP and parsoid output differ for this, and since this is primarily
14838 ## for testing Parsoid's serializer, marking this Parsoid only
14839 !!test
14840 Empty TR followed by mixed-ws-comment line should RT correctly
14841 !!options
14842 parsoid
14843 !!input
14844 {|
14845 |-
14846 <!--c-->
14847 |-
14848 <!--c--> <!--d-->
14849 |}
14850 !!result
14851 <table>
14852 <tbody>
14853 <tr>
14854 <td> <!--c--></td></tr>
14855 <tr>
14856 <td><!--c--> <!--d--></td></tr>
14857 </tbody></table>
14858
14859 !!end
14860
14861 !!test
14862 Multi-line image caption generated by templates with/without trailing newlines
14863 !!options
14864 parsoid
14865 !!input
14866 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14867 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14868 !!result
14869 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
14870 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
14871
14872 !!end
14873
14874 ## PHP emits broken html for this, and since this is primarily
14875 ## a Parsoid serializer test, marking this Parsoid only
14876 !!test
14877 Improperly nested inline or quotes tags with whitespace in between
14878 !!options
14879 parsoid
14880 !!input
14881 <span> <s>x</span> </s>
14882 ''' ''x''' ''
14883 !!result
14884 <p><span> <s>x</s></span><s> </s>
14885 <b> <i>x</i></b><i> </i>
14886 </p>
14887 !!end
14888
14889 TODO:
14890 more images
14891 more tables
14892 character entities
14893 and much more
14894 Try for 100% code coverage